File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 15
15
"""Test maxStalenessSeconds support."""
16
16
from __future__ import annotations
17
17
18
+ import asyncio
18
19
import os
19
20
import sys
20
21
import time
40
41
else :
41
42
TEST_PATH = os .path .join (Path (__file__ ).resolve ().parent .parent , "max_staleness" )
42
43
44
+
43
45
class TestAllScenarios (create_selection_tests (TEST_PATH )): # type: ignore
44
46
pass
45
47
@@ -124,21 +126,22 @@ async def test_last_write_date(self):
124
126
client = await self .async_rs_or_single_client (heartbeatFrequencyMS = 500 )
125
127
await client .pymongo_test .test .insert_one ({})
126
128
# Wait for the server description to be updated.
127
- time .sleep (1 )
129
+ await asyncio .sleep (1 )
128
130
server = await client ._topology .select_server (writable_server_selector , _Op .TEST )
129
131
first = server .description .last_write_date
130
132
self .assertTrue (first )
131
133
# The first last_write_date may correspond to a internal server write,
132
134
# sleep so that the next write does not occur within the same second.
133
- time .sleep (1 )
135
+ await asyncio .sleep (1 )
134
136
await client .pymongo_test .test .insert_one ({})
135
137
# Wait for the server description to be updated.
136
- time .sleep (1 )
138
+ await asyncio .sleep (1 )
137
139
server = await client ._topology .select_server (writable_server_selector , _Op .TEST )
138
140
second = server .description .last_write_date
139
141
assert first is not None
140
142
141
143
assert second is not None
144
+ print (second , first )
142
145
self .assertGreater (second , first )
143
146
self .assertLess (second , first + 10 )
144
147
Original file line number Diff line number Diff line change 15
15
"""Test maxStalenessSeconds support."""
16
16
from __future__ import annotations
17
17
18
+ import asyncio
18
19
import os
19
20
import sys
20
21
import time
40
41
else :
41
42
TEST_PATH = os .path .join (Path (__file__ ).resolve ().parent .parent , "max_staleness" )
42
43
44
+
43
45
class TestAllScenarios (create_selection_tests (TEST_PATH )): # type: ignore
44
46
pass
45
47
@@ -139,6 +141,7 @@ def test_last_write_date(self):
139
141
assert first is not None
140
142
141
143
assert second is not None
144
+ print (second , first )
142
145
self .assertGreater (second , first )
143
146
self .assertLess (second , first + 10 )
144
147
You can’t perform that action at this time.
0 commit comments