diff --git a/test/asynchronous/test_retryable_reads.py b/test/asynchronous/test_retryable_reads.py index f649f7d6f7..d576f8987e 100644 --- a/test/asynchronous/test_retryable_reads.py +++ b/test/asynchronous/test_retryable_reads.py @@ -34,7 +34,7 @@ from test.utils import ( CMAPListener, OvertCommandListener, - set_fail_point, + async_set_fail_point, ) from pymongo.monitoring import ( @@ -167,7 +167,7 @@ async def test_retryable_reads_in_sharded_cluster_multiple_available(self): for mongos in async_client_context.mongos_seeds().split(","): client = await self.async_rs_or_single_client(mongos) - set_fail_point(client, fail_command) + await async_set_fail_point(client, fail_command) self.addAsyncCleanup(client.close) mongos_clients.append(client) @@ -186,7 +186,7 @@ async def test_retryable_reads_in_sharded_cluster_multiple_available(self): # Disable failpoints on each mongos for client in mongos_clients: fail_command["mode"] = "off" - set_fail_point(client, fail_command) + await async_set_fail_point(client, fail_command) self.assertEqual(len(listener.failed_events), 2) self.assertEqual(len(listener.succeeded_events), 0) diff --git a/test/utils.py b/test/utils.py index 6eefd1c7ea..9615034899 100644 --- a/test/utils.py +++ b/test/utils.py @@ -1157,3 +1157,9 @@ def set_fail_point(client, command_args): cmd = SON([("configureFailPoint", "failCommand")]) cmd.update(command_args) client.admin.command(cmd) + + +async def async_set_fail_point(client, command_args): + cmd = SON([("configureFailPoint", "failCommand")]) + cmd.update(command_args) + await client.admin.command(cmd) diff --git a/tools/synchro.py b/tools/synchro.py index 34de110358..f754b5ecc7 100644 --- a/tools/synchro.py +++ b/tools/synchro.py @@ -103,6 +103,7 @@ "PyMongo|async": "PyMongo", "AsyncTestGridFile": "TestGridFile", "AsyncTestGridFileNoConnect": "TestGridFileNoConnect", + "async_set_fail_point": "set_fail_point", } docstring_replacements: dict[tuple[str, str], str] = {