Files
wehub-resource-sync bf2343b7e4
Integration Tests - MySQL + Elasticsearch / Detect Changes (push) Has been cancelled
Integration Tests - MySQL + Elasticsearch / integration-tests-mysql-elasticsearch (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + Elasticsearch + Redis / integration-tests-postgres-elasticsearch-redis (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / Detect Changes (push) Has been cancelled
Integration Tests - PostgreSQL + OpenSearch / integration-tests-postgres-opensearch (push) Has been cancelled
Java Checkstyle / java-checkstyle (push) Has been cancelled
Maven Collate Tests / maven-collate-ci (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests-status (push) Has been cancelled
Publish Package to Maven Central Repository / publish-maven-packages (push) Has been cancelled
OpenMetadata Service Unit Tests / Detect Changes (push) Has been cancelled
OpenMetadata Service Unit Tests / openmetadata-service-unit-tests (push) Has been cancelled
OpenMetadata Service Unit Tests / k8s_operator-unit-tests (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:35:45 +08:00

50 lines
1.9 KiB
Python

# Copyright 2025 Collate
# Licensed under the Collate Community License, Version 1.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/LICENSE
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Wiring/config assertions for the resilient OMeta HTTP adapter."""
import socket
import requests
from urllib3.util.retry import Retry
from metadata.ingestion.ometa.http_adapter import (
KeepAliveRetryAdapter,
build_keepalive_socket_options,
build_transport_retry,
mount_resilient_adapter,
)
def test_keepalive_options_enable_so_keepalive():
assert (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) in build_keepalive_socket_options()
def test_transport_retry_is_transport_only_and_idempotent_safe():
retry = build_transport_retry()
assert (retry.total, retry.connect, retry.read, retry.status) == (3, 2, 1, 0)
assert retry.raise_on_status is False
assert "POST" not in retry.allowed_methods
assert "GET" in retry.allowed_methods
def test_mount_resilient_adapter_wires_keepalive_and_retry():
session = requests.Session()
mount_resilient_adapter(session)
for scheme in ("https://", "http://"):
adapter = session.get_adapter(f"{scheme}example.com")
assert isinstance(adapter, KeepAliveRetryAdapter)
assert isinstance(adapter.max_retries, Retry)
assert adapter.max_retries.read == 1
pooled = session.get_adapter("https://x").poolmanager.connection_pool_kw["socket_options"]
assert (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) in pooled