PYTHON-5366 - test_pool_reset waits until Pool.reset() increments gen… (#2797)
This commit is contained in:
parent
552b7bf47b
commit
9a8e34c726
@ -23,7 +23,7 @@ sys.path[0:0] = [""]
|
|||||||
|
|
||||||
from test import client_knobs, unittest
|
from test import client_knobs, unittest
|
||||||
from test.pymongo_mocks import DummyMonitor
|
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 test.utils_shared import wait_until
|
||||||
|
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
@ -755,7 +755,6 @@ def wait_for_primary(topology):
|
|||||||
class TestTopologyErrors(TopologyTest):
|
class TestTopologyErrors(TopologyTest):
|
||||||
# Errors when calling hello.
|
# Errors when calling hello.
|
||||||
|
|
||||||
@flaky(reason="PYTHON-5366")
|
|
||||||
def test_pool_reset(self):
|
def test_pool_reset(self):
|
||||||
# hello succeeds at first, then always raises socket error.
|
# hello succeeds at first, then always raises socket error.
|
||||||
hello_count = [0]
|
hello_count = [0]
|
||||||
@ -776,7 +775,11 @@ class TestTopologyErrors(TopologyTest):
|
|||||||
|
|
||||||
# Pool is reset by hello failure.
|
# Pool is reset by hello failure.
|
||||||
t.request_check_all()
|
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):
|
def test_hello_retry(self):
|
||||||
# hello succeeds at first, then raises socket error, then succeeds.
|
# hello succeeds at first, then raises socket error, then succeeds.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user