|
35 | 35 | client_knobs,
|
36 | 36 | unittest,
|
37 | 37 | )
|
| 38 | +from test.asynchronous.utils_spec_runner import SpecRunnerTask |
38 | 39 | from test.unified_format_shared import (
|
39 | 40 | KMS_TLS_OPTS,
|
40 | 41 | PLACEHOLDER_MAP,
|
|
58 | 59 | snake_to_camel,
|
59 | 60 | wait_until,
|
60 | 61 | )
|
61 |
| -from test.utils_spec_runner import SpecRunnerThread |
62 | 62 | from test.version import Version
|
63 | 63 | from typing import Any, Dict, List, Mapping, Optional
|
64 | 64 |
|
@@ -382,8 +382,8 @@ async def drop(self: AsyncGridFSBucket, *args: Any, **kwargs: Any) -> None:
|
382 | 382 | return
|
383 | 383 | elif entity_type == "thread":
|
384 | 384 | name = spec["id"]
|
385 |
| - thread = SpecRunnerThread(name) |
386 |
| - thread.start() |
| 385 | + thread = SpecRunnerTask(name) |
| 386 | + await thread.start() |
387 | 387 | self[name] = thread
|
388 | 388 | return
|
389 | 389 |
|
@@ -1177,16 +1177,16 @@ def primary_changed() -> bool:
|
1177 | 1177 |
|
1178 | 1178 | wait_until(primary_changed, "change primary", timeout=timeout)
|
1179 | 1179 |
|
1180 |
| - def _testOperation_runOnThread(self, spec): |
| 1180 | + async def _testOperation_runOnThread(self, spec): |
1181 | 1181 | """Run the 'runOnThread' operation."""
|
1182 | 1182 | thread = self.entity_map[spec["thread"]]
|
1183 |
| - thread.schedule(lambda: self.run_entity_operation(spec["operation"])) |
| 1183 | + await thread.schedule(functools.partial(self.run_entity_operation, spec["operation"])) |
1184 | 1184 |
|
1185 |
| - def _testOperation_waitForThread(self, spec): |
| 1185 | + async def _testOperation_waitForThread(self, spec): |
1186 | 1186 | """Run the 'waitForThread' operation."""
|
1187 | 1187 | thread = self.entity_map[spec["thread"]]
|
1188 |
| - thread.stop() |
1189 |
| - thread.join(10) |
| 1188 | + await thread.stop() |
| 1189 | + await thread.join(10) |
1190 | 1190 | if thread.exc:
|
1191 | 1191 | raise thread.exc
|
1192 | 1192 | self.assertFalse(thread.is_alive(), "Thread {} is still running".format(spec["thread"]))
|
|
0 commit comments