From a46331d478d68fca68bb9f85302fe411373f75b6 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Mon, 18 Mar 2024 16:22:35 -0700 Subject: [PATCH 1/2] PYTHON-4286 Remove duplicate test_detect_external_db (#1554) --- test/test_client.py | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/test/test_client.py b/test/test_client.py index 8f7fa6748..fb56f5057 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -102,9 +102,9 @@ from pymongo.errors import ( ServerSelectionTimeoutError, WriteConcernError, ) -from pymongo.mongo_client import MongoClient, _detect_external_db +from pymongo.mongo_client import MongoClient from pymongo.monitoring import ServerHeartbeatListener, ServerHeartbeatStartedEvent -from pymongo.pool import _METADATA, DOCKER_ENV_PATH, ENV_VAR_K8S, Connection, PoolOptions +from pymongo.pool import _METADATA, ENV_VAR_K8S, Connection, PoolOptions from pymongo.read_preferences import ReadPreference from pymongo.server_description import ServerDescription from pymongo.server_selectors import readable_server_selector, writable_server_selector @@ -597,34 +597,6 @@ class ClientUnitTest(unittest.TestCase): with self.assertWarns(UserWarning): MongoClient(multi_host) - def test_detect_external_db(self): - hosts = [ - "normalhost.com", - "host.cosmos.AZURE.com", - "host.docdb.amazonaws.com", - "host.docdb-elastic.amazonaws.com", - ] - with self.assertLogs("pymongo", level="INFO") as cm: - for host in hosts: - _detect_external_db(host) - logs = [record.message for record in cm.records if record.name == "pymongo.client"] - self.assertEqual(len(logs), 3) - self.assertEqual( - logs[0], - "You appear to be connected to a CosmosDB cluster. For more information regarding feature " - "compatibility and support please visit https://www.mongodb.com/supportability/cosmosdb", - ) - self.assertEqual( - logs[1], - "You appear to be connected to a DocumentDB cluster. For more information regarding feature " - "compatibility and support please visit https://www.mongodb.com/supportability/documentdb", - ) - self.assertEqual( - logs[2], - "You appear to be connected to a DocumentDB cluster. For more information regarding feature " - "compatibility and support please visit https://www.mongodb.com/supportability/documentdb", - ) - class TestClient(IntegrationTest): def test_multiple_uris(self): From f7a7b5a3329981cf39edfa4246578960796da825 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Tue, 19 Mar 2024 15:23:47 -0700 Subject: [PATCH 2/2] PYTHON-4271 Skip failing serverless proxy tests (#1555) --- .evergreen/config.yml | 4 ++++ test/unified_format.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index bb3889c3c..f7d91ee78 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -417,6 +417,9 @@ functions: if [ -n "${test_serverless}" ]; then export TEST_SERVERLESS=1 fi + if [ -n "${IS_SERVERLESS_PROXY}" ]; then + export IS_SERVERLESS_PROXY=1 + fi if [ -n "${TEST_INDEX_MANAGEMENT}" ]; then export TEST_INDEX_MANAGEMENT=1 fi @@ -2479,6 +2482,7 @@ axes: variables: test_serverless: true VAULT_NAME: "serverless_next" + IS_SERVERLESS_PROXY: true batchtime: 10080 # 7 days buildvariants: diff --git a/test/unified_format.py b/test/unified_format.py index 89cef20c9..39a208cb6 100644 --- a/test/unified_format.py +++ b/test/unified_format.py @@ -1030,6 +1030,7 @@ class UnifiedSpecTestMixinV1(IntegrationTest): # initialize internals self.match_evaluator = MatchEvaluatorUtil(self) + self.IS_SERVERLESS_PROXY = os.environ.get("IS_SERVERLESS_PROXY") def maybe_skip_test(self, spec): # add any special-casing for skipping tests here @@ -1051,6 +1052,12 @@ class UnifiedSpecTestMixinV1(IntegrationTest): if "unpin after non-transient error on abort" in spec["description"]: if client_context.version[0] == 8: self.skipTest("Skipping TransientTransactionError pending PYTHON-4182") + if self.IS_SERVERLESS_PROXY is not None and ( + "errors during the initial connection hello are ignored" in spec["description"] + or "pinned connection is released after a transient network commit error" + in spec["description"] + ): + self.skipTest("waiting on CLOUDP-202309") class_name = self.__class__.__name__.lower() description = spec["description"].lower()