Skip to content

Commit c4beba1

Browse files
committed
update discovery and monitoring based on mongodb#1925
1 parent 9484d7a commit c4beba1

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

test/asynchronous/test_discovery_and_monitoring.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class TestClusterTimeComparison(AsyncPyMongoTestCase):
258258
async def test_cluster_time_comparison(self):
259259
t = await create_mock_topology("mongodb://host")
260260

261-
async def send_cluster_time(time, inc, should_update):
261+
async def send_cluster_time(time, inc):
262262
old = t.max_cluster_time()
263263
new = {"clusterTime": Timestamp(time, inc)}
264264
await got_hello(
@@ -273,16 +273,14 @@ async def send_cluster_time(time, inc, should_update):
273273
)
274274

275275
actual = t.max_cluster_time()
276-
if should_update:
277-
self.assertEqual(actual, new)
278-
else:
279-
self.assertEqual(actual, old)
280-
281-
await send_cluster_time(0, 1, True)
282-
await send_cluster_time(2, 2, True)
283-
await send_cluster_time(2, 1, False)
284-
await send_cluster_time(1, 3, False)
285-
await send_cluster_time(2, 3, True)
276+
# We never update $clusterTime from monitoring connections.
277+
self.assertEqual(actual, old)
278+
279+
await send_cluster_time(0, 1)
280+
await send_cluster_time(2, 2)
281+
await send_cluster_time(2, 1)
282+
await send_cluster_time(1, 3)
283+
await send_cluster_time(2, 3)
286284

287285

288286
class TestIgnoreStaleErrors(AsyncIntegrationTest):

test/asynchronous/unified_format.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,20 +1385,18 @@ async def run_scenario(self, spec, uri=None):
13851385
# operations during test set up and tear down.
13861386
await self.kill_all_sessions()
13871387

1388-
if "csot" in self.id().lower() or "discovery_and_monitoring" in self.id().lower():
1388+
if "csot" in self.id().lower():
13891389
# Retry CSOT tests up to 2 times to deal with flakey tests.
13901390
# discovery_and_monitoring tests on windows are also flakey
13911391
attempts = 3
13921392
for i in range(attempts):
13931393
try:
13941394
return await self._run_scenario(spec, uri)
1395-
except (AssertionError, OperationFailure, _OperationCancelled) as exc:
1395+
except (AssertionError, OperationFailure) as exc:
13961396
if isinstance(exc, OperationFailure) and (
13971397
_IS_SYNC or "failpoint" not in exc._message
13981398
):
13991399
raise
1400-
if isinstance(exc, _OperationCancelled) and _IS_SYNC:
1401-
raise
14021400
if i < attempts - 1:
14031401
print(
14041402
f"Retrying after attempt {i+1} of {self.id()} failed with:\n"

test/unified_format.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,20 +1372,18 @@ def run_scenario(self, spec, uri=None):
13721372
# operations during test set up and tear down.
13731373
self.kill_all_sessions()
13741374

1375-
if "csot" in self.id().lower() or "discovery_and_monitoring" in self.id().lower():
1375+
if "csot" in self.id().lower():
13761376
# Retry CSOT tests up to 2 times to deal with flakey tests.
13771377
# discovery_and_monitoring tests on windows are also flakey
13781378
attempts = 3
13791379
for i in range(attempts):
13801380
try:
13811381
return self._run_scenario(spec, uri)
1382-
except (AssertionError, OperationFailure, _OperationCancelled) as exc:
1382+
except (AssertionError, OperationFailure) as exc:
13831383
if isinstance(exc, OperationFailure) and (
13841384
_IS_SYNC or "failpoint" not in exc._message
13851385
):
13861386
raise
1387-
if isinstance(exc, _OperationCancelled) and _IS_SYNC:
1388-
raise
13891387
if i < attempts - 1:
13901388
print(
13911389
f"Retrying after attempt {i+1} of {self.id()} failed with:\n"

0 commit comments

Comments
 (0)