Skip to content

Commit b00c64e

Browse files
committed
add async_set_fail_point
1 parent 6d657c1 commit b00c64e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

test/asynchronous/test_retryable_reads.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from test.utils import (
3535
CMAPListener,
3636
OvertCommandListener,
37-
set_fail_point,
37+
async_set_fail_point,
3838
)
3939

4040
from pymongo.monitoring import (
@@ -167,7 +167,7 @@ async def test_retryable_reads_in_sharded_cluster_multiple_available(self):
167167

168168
for mongos in async_client_context.mongos_seeds().split(","):
169169
client = await self.async_rs_or_single_client(mongos)
170-
set_fail_point(client, fail_command)
170+
await async_set_fail_point(client, fail_command)
171171
self.addAsyncCleanup(client.close)
172172
mongos_clients.append(client)
173173

@@ -186,7 +186,7 @@ async def test_retryable_reads_in_sharded_cluster_multiple_available(self):
186186
# Disable failpoints on each mongos
187187
for client in mongos_clients:
188188
fail_command["mode"] = "off"
189-
set_fail_point(client, fail_command)
189+
await async_set_fail_point(client, fail_command)
190190

191191
self.assertEqual(len(listener.failed_events), 2)
192192
self.assertEqual(len(listener.succeeded_events), 0)

test/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,3 +1157,9 @@ def set_fail_point(client, command_args):
11571157
cmd = SON([("configureFailPoint", "failCommand")])
11581158
cmd.update(command_args)
11591159
client.admin.command(cmd)
1160+
1161+
1162+
async def async_set_fail_point(client, command_args):
1163+
cmd = SON([("configureFailPoint", "failCommand")])
1164+
cmd.update(command_args)
1165+
await client.admin.command(cmd)

tools/synchro.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"PyMongo|async": "PyMongo",
104104
"AsyncTestGridFile": "TestGridFile",
105105
"AsyncTestGridFileNoConnect": "TestGridFileNoConnect",
106+
"async_set_fail_point": "set_fail_point",
106107
}
107108

108109
docstring_replacements: dict[tuple[str, str], str] = {

0 commit comments

Comments
 (0)