Skip to content

Commit 08e7324

Browse files
committed
handle more flakiness
1 parent 3ba3720 commit 08e7324

File tree

7 files changed

+35
-15
lines changed

7 files changed

+35
-15
lines changed

test/asynchronous/test_client_bulk_write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ async def asyncSetUp(self):
627627

628628
@async_client_context.require_version_min(8, 0, 0, -24)
629629
@async_client_context.require_failCommand_fail_point
630-
@flaky
630+
@flaky(max_runs=3, affects_cpython_linux=True)
631631
async def test_timeout_in_multi_batch_bulk_write(self):
632632
_OVERHEAD = 500
633633

test/asynchronous/test_encryption.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import warnings
3333
from test.asynchronous import AsyncIntegrationTest, AsyncPyMongoTestCase, async_client_context
3434
from test.asynchronous.test_bulk import AsyncBulkTestBase
35+
from test.asynchronous.utils import flaky
3536
from test.asynchronous.utils_spec_runner import AsyncSpecRunner, AsyncSpecTestCreator
3637
from threading import Thread
3738
from typing import Any, Dict, Mapping, Optional
@@ -3275,6 +3276,8 @@ async def asyncSetUp(self):
32753276
OPTS,
32763277
)
32773278

3279+
# PYTHON-4982
3280+
@flaky
32783281
async def test_01_simple_create(self):
32793282
coll, _ = await self.client_encryption.create_encrypted_collection(
32803283
database=self.db,
@@ -3491,6 +3494,8 @@ async def asyncSetUp(self) -> None:
34913494
hello = await self.mongocryptd_client.db.command("hello")
34923495
self.assertNotIn("logicalSessionTimeoutMinutes", hello)
34933496

3497+
# PYTHON-4982
3498+
@flaky
34943499
async def test_implicit_session_ignored_when_unsupported(self):
34953500
self.listener.reset()
34963501
with self.assertRaises(OperationFailure):

test/asynchronous/unified_format.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,12 @@ def maybe_skip_test(self, spec):
537537
slow_win32 = [
538538
"maxtimems value in the command is less than timeoutms",
539539
"non-tailable cursor lifetime remaining timeoutms applied to getmore if timeoutmode is unset",
540-
"maxtimems applied to update during a rename",
541-
"maxtimems applied to find to get chunks",
542-
"maxtimems applied to find to get files document",
543-
"maxtimems applied to find command",
544540
]
545541
slow_macos = [
546542
"non-tailable cursor lifetime remaining timeoutms applied to getmore if timeoutmode is unset"
547543
]
548-
if sys.platform == "win32" and description in slow_win32:
549-
self.skipTest("PYTHON-3522 CSOT test run too slow on Windows")
544+
if sys.platform == "win32" and description in slow_win32 or "gridfs" in class_name:
545+
self.skipTest("PYTHON-3522 CSOT test runs too slow on Windows")
550546
if sys.platform == "darwin" and description in slow_macos:
551547
self.skipTest("PYTHON-3522 CSOT test runs too slow on MacOS")
552548
if async_client_context.storage_engine == "mmapv1":
@@ -1390,6 +1386,13 @@ async def run_scenario(self, spec, uri=None):
13901386
".*test_discovery_and_monitoring.TestUnifiedInterruptInUsePoolClear.*",
13911387
# PYTHON-5174
13921388
".*Driver_extends_timeout_while_streaming",
1389+
# PYTHON-5315
1390+
".*TestSrvPolling.test_recover_from_initially_.*",
1391+
# PYTHON-4987
1392+
".*UnknownTransactionCommitResult_labels_to_connection_errors",
1393+
# PYTHON-3689
1394+
".*TestProse.test_load_balancing",
1395+
# PYTHON-3522
13931396
".*csot.*",
13941397
]
13951398
for flaky_test in flaky_tests:
@@ -1398,6 +1401,7 @@ async def run_scenario(self, spec, uri=None):
13981401
options = dict(reset_func=self.asyncSetUp, func_name=func_name)
13991402
if "csot" in func_name:
14001403
options["max_runs"] = 3
1404+
options["affects_cpython_linux"] = True
14011405
decorator = flaky(**options)
14021406
await decorator(self._run_scenario)(spec, uri)
14031407
return

test/test_client_bulk_write.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def setUp(self):
623623

624624
@client_context.require_version_min(8, 0, 0, -24)
625625
@client_context.require_failCommand_fail_point
626-
@flaky
626+
@flaky(max_runs=3, affects_cpython_linux=True)
627627
def test_timeout_in_multi_batch_bulk_write(self):
628628
_OVERHEAD = 500
629629

test/test_encryption.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import warnings
3333
from test import IntegrationTest, PyMongoTestCase, client_context
3434
from test.test_bulk import BulkTestBase
35+
from test.utils import flaky
3536
from test.utils_spec_runner import SpecRunner, SpecTestCreator
3637
from threading import Thread
3738
from typing import Any, Dict, Mapping, Optional
@@ -3257,6 +3258,8 @@ def setUp(self):
32573258
OPTS,
32583259
)
32593260

3261+
# PYTHON-4982
3262+
@flaky
32603263
def test_01_simple_create(self):
32613264
coll, _ = self.client_encryption.create_encrypted_collection(
32623265
database=self.db,
@@ -3473,6 +3476,8 @@ def setUp(self) -> None:
34733476
hello = self.mongocryptd_client.db.command("hello")
34743477
self.assertNotIn("logicalSessionTimeoutMinutes", hello)
34753478

3479+
# PYTHON-4982
3480+
@flaky
34763481
def test_implicit_session_ignored_when_unsupported(self):
34773482
self.listener.reset()
34783483
with self.assertRaises(OperationFailure):

test/test_topology.py

Lines changed: 3 additions & 1 deletion
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
26+
from test.utils import MockPool, flaky
2727
from test.utils_shared import wait_until
2828

2929
from bson.objectid import ObjectId
@@ -750,6 +750,8 @@ def get_primary():
750750
class TestTopologyErrors(TopologyTest):
751751
# Errors when calling hello.
752752

753+
# PYTHON-5366
754+
@flaky
753755
def test_pool_reset(self):
754756
# hello succeeds at first, then always raises socket error.
755757
hello_count = [0]

test/unified_format.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,16 +536,12 @@ def maybe_skip_test(self, spec):
536536
slow_win32 = [
537537
"maxtimems value in the command is less than timeoutms",
538538
"non-tailable cursor lifetime remaining timeoutms applied to getmore if timeoutmode is unset",
539-
"maxtimems applied to update during a rename",
540-
"maxtimems applied to find to get chunks",
541-
"maxtimems applied to find to get files document",
542-
"maxtimems applied to find command",
543539
]
544540
slow_macos = [
545541
"non-tailable cursor lifetime remaining timeoutms applied to getmore if timeoutmode is unset"
546542
]
547-
if sys.platform == "win32" and description in slow_win32:
548-
self.skipTest("PYTHON-3522 CSOT test run too slow on Windows")
543+
if sys.platform == "win32" and description in slow_win32 or "gridfs" in class_name:
544+
self.skipTest("PYTHON-3522 CSOT test runs too slow on Windows")
549545
if sys.platform == "darwin" and description in slow_macos:
550546
self.skipTest("PYTHON-3522 CSOT test runs too slow on MacOS")
551547
if client_context.storage_engine == "mmapv1":
@@ -1377,6 +1373,13 @@ def run_scenario(self, spec, uri=None):
13771373
".*test_discovery_and_monitoring.TestUnifiedInterruptInUsePoolClear.*",
13781374
# PYTHON-5174
13791375
".*Driver_extends_timeout_while_streaming",
1376+
# PYTHON-5315
1377+
".*TestSrvPolling.test_recover_from_initially_.*",
1378+
# PYTHON-4987
1379+
".*UnknownTransactionCommitResult_labels_to_connection_errors",
1380+
# PYTHON-3689
1381+
".*TestProse.test_load_balancing",
1382+
# PYTHON-3522
13801383
".*csot.*",
13811384
]
13821385
for flaky_test in flaky_tests:
@@ -1385,6 +1388,7 @@ def run_scenario(self, spec, uri=None):
13851388
options = dict(reset_func=self.setUp, func_name=func_name)
13861389
if "csot" in func_name:
13871390
options["max_runs"] = 3
1391+
options["affects_cpython_linux"] = True
13881392
decorator = flaky(**options)
13891393
decorator(self._run_scenario)(spec, uri)
13901394
return

0 commit comments

Comments
 (0)