PYTHON-5366 - test_pool_reset waits until Pool.reset() increments gen… (#2797)

This commit is contained in:
Noah Stapp 2026-05-18 10:29:44 -04:00 committed by GitHub
parent 552b7bf47b
commit 9a8e34c726
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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