Skip to content

Commit 9a8e34c

Browse files
authored
PYTHON-5366 - test_pool_reset waits until Pool.reset() increments gen… (#2797)
1 parent 552b7bf commit 9a8e34c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

test/test_topology.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from test import client_knobs, unittest
2525
from test.pymongo_mocks import DummyMonitor
26-
from test.utils import MockPool, flaky
26+
from test.utils import MockPool
2727
from test.utils_shared import wait_until
2828

2929
from bson.objectid import ObjectId
@@ -755,7 +755,6 @@ def get_primary():
755755
class TestTopologyErrors(TopologyTest):
756756
# Errors when calling hello.
757757

758-
@flaky(reason="PYTHON-5366")
759758
def test_pool_reset(self):
760759
# hello succeeds at first, then always raises socket error.
761760
hello_count = [0]
@@ -776,7 +775,11 @@ def _check_with_socket(self, *args, **kwargs):
776775

777776
# Pool is reset by hello failure.
778777
t.request_check_all()
779-
self.assertNotEqual(generation, server.pool.gen.get_overall())
778+
# Wait for the monitor's hello failure to trigger Pool.reset() and bump the generation.
779+
wait_until(
780+
lambda: server.pool.gen.get_overall() != generation,
781+
"pool reset after failed monitor check",
782+
)
780783

781784
def test_hello_retry(self):
782785
# hello succeeds at first, then raises socket error, then succeeds.

0 commit comments

Comments
 (0)