From 9a8e34c726098596b1dcb54e583aa88539903a82 Mon Sep 17 00:00:00 2001 From: Noah Stapp Date: Mon, 18 May 2026 10:29:44 -0400 Subject: [PATCH] =?UTF-8?q?PYTHON-5366=20-=20test=5Fpool=5Freset=20waits?= =?UTF-8?q?=20until=20Pool.reset()=20increments=20gen=E2=80=A6=20(#2797)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_topology.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/test_topology.py b/test/test_topology.py index f2e7a91cd..c87c48819 100644 --- a/test/test_topology.py +++ b/test/test_topology.py @@ -23,7 +23,7 @@ sys.path[0:0] = [""] from test import client_knobs, unittest from test.pymongo_mocks import DummyMonitor -from test.utils import MockPool, flaky +from test.utils import MockPool from test.utils_shared import wait_until from bson.objectid import ObjectId @@ -755,7 +755,6 @@ def wait_for_primary(topology): class TestTopologyErrors(TopologyTest): # Errors when calling hello. - @flaky(reason="PYTHON-5366") def test_pool_reset(self): # hello succeeds at first, then always raises socket error. hello_count = [0] @@ -776,7 +775,11 @@ class TestTopologyErrors(TopologyTest): # Pool is reset by hello failure. t.request_check_all() - self.assertNotEqual(generation, server.pool.gen.get_overall()) + # Wait for the monitor's hello failure to trigger Pool.reset() and bump the generation. + wait_until( + lambda: server.pool.gen.get_overall() != generation, + "pool reset after failed monitor check", + ) def test_hello_retry(self): # hello succeeds at first, then raises socket error, then succeeds.