From 00c29600decda0081959d532fc8f882a16554fc0 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Tue, 29 Oct 2024 11:34:06 -0400 Subject: [PATCH 1/2] PYTHON-4766 - Fix logic for determining whether to populate BulkWriteException.partialResult (#1980) --- test/crud/unified/client-bulkWrite-partialResults.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/crud/unified/client-bulkWrite-partialResults.json b/test/crud/unified/client-bulkWrite-partialResults.json index b35e94a2e..1b75e3783 100644 --- a/test/crud/unified/client-bulkWrite-partialResults.json +++ b/test/crud/unified/client-bulkWrite-partialResults.json @@ -486,7 +486,7 @@ ] }, { - "description": "partialResult is set when first operation fails during an unordered bulk write (summary)", + "description": "partialResult is set when second operation fails during an unordered bulk write (summary)", "operations": [ { "object": "client0", From dfb6a9a4f337c780be832a2f6fe84fe292e24015 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 29 Oct 2024 11:08:22 -0500 Subject: [PATCH 2/2] PYTHON-4209 Ensure that no error is raised for unknown auth mechanism (#1981) --- test/mockupdb/test_handshake.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/mockupdb/test_handshake.py b/test/mockupdb/test_handshake.py index 7cc3017c8..752c4f842 100644 --- a/test/mockupdb/test_handshake.py +++ b/test/mockupdb/test_handshake.py @@ -229,6 +229,39 @@ class TestHandshake(unittest.TestCase): future() return + def test_client_handshake_saslSupportedMechs_unknown(self): + server = MockupDB() + server.run() + self.addCleanup(server.stop) + + primary_response = OpReply( + "ismaster", + True, + minWireVersion=2, + maxWireVersion=MIN_SUPPORTED_WIRE_VERSION, + saslSupportedMechs=["SCRAM-SHA-256", "does_not_exist"], + ) + client = MongoClient( + server.uri, authmechanism="PLAIN", username="username", password="password" + ) + + self.addCleanup(client.close) + + # New monitoring connections send data during handshake. + heartbeat = server.receives("ismaster") + heartbeat.ok(primary_response) + + future = go(client.db.command, "whatever") + for request in server: + if request.matches("ismaster"): + request.ok(primary_response) + elif request.matches("saslStart"): + request.ok("saslStart", True, conversationId=1, payload=b"", done=True, ok=1) + else: + request.ok() + future() + return + def test_handshake_load_balanced(self): self.hello_with_option_helper(OpMsg, loadBalanced=True) with self.assertRaisesRegex(AssertionError, "does not match"):