Skip to content

Commit e17e60f

Browse files
committed
Decrease network latency in test
1 parent cc8ad63 commit e17e60f

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

tests/functional/single_server/client_test.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,12 @@ def test_random_timeout():
167167
should_fail = 0
168168
for _ in range(100):
169169
sleep_time = random.randint(10, 100)
170-
# error margin of 10 ms
171-
should_fail += sleep_time > 60
170+
# considering network latency, adding an error margin of 5 ms
171+
should_fail += sleep_time > 55
172172
try:
173173
msg = client.call("sleep", sleep_time, timeout=50)
174174
assert msg == f"slept for {sleep_time} msecs"
175175
except zero.error.TimeoutException:
176-
assert (
177-
sleep_time > 1
178-
) # considering network latency, 50 msecs is too low in github actions
179176
fails += 1
180177

181178
client.close()
@@ -190,15 +187,12 @@ def test_random_timeout_async():
190187
should_fail = 0
191188
for _ in range(100):
192189
sleep_time = random.randint(10, 100)
193-
# error margin of 10 ms
194-
should_fail += sleep_time > 60
190+
# considering network latency, adding an error margin of 5 ms
191+
should_fail += sleep_time > 55
195192
try:
196193
msg = asyncio.run(client.call("sleep", sleep_time, timeout=50))
197194
assert msg == f"slept for {sleep_time} msecs"
198195
except zero.error.TimeoutException:
199-
assert (
200-
sleep_time > 1
201-
) # considering network latency, 50 msecs is too low in github actions
202196
fails += 1
203197

204198
client.close()

0 commit comments

Comments
 (0)