Merge branch 'master' of github.com:mongodb/mongo-python-driver

This commit is contained in:
Steven Silvester 2024-03-22 06:23:14 -05:00
commit 5b8ed2701c
No known key found for this signature in database
GPG Key ID: B1BF5EC3A8B32F91
3 changed files with 13 additions and 30 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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()