Skip to content

Commit 417f97e

Browse files
committed
test: widen safety margin in test_response_aggregation_timings_multiple
1 parent 692a2c4 commit 417f97e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎tests/test_handlers.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,19 +1783,19 @@ async def test_response_aggregation_timings_multiple(run_isolated, disable_dupli
17831783
protocol.last_time = 0 # manually reset the last time to avoid duplicate packet suppression
17841784
protocol.datagram_received(query2.packets()[0], ("127.0.0.1", const._MDNS_PORT))
17851785
protocol.last_time = 0 # manually reset the last time to avoid duplicate packet suppression
1786-
# The delay should increase with two packets and
1787-
# 900ms is beyond the maximum aggregation delay
1788-
# when there is no network protection delay
1789-
await asyncio.sleep(0.9)
1786+
# The minimum protected send_after is 1000ms + 20ms random; sleep
1787+
# well under that so coarse timers on slow runners cannot push the
1788+
# send into this window and flake the assertion.
1789+
await asyncio.sleep(0.5)
17901790
calls = send_mock.mock_calls
17911791
assert len(calls) == 0
17921792

17931793
# 1000ms (1s network protection delays)
1794-
# - 900ms (already slept)
1794+
# - 500ms (already slept)
17951795
# + 120ms (maximum random delay)
17961796
# + 200ms (maximum protected aggregation delay)
17971797
# + 20ms (execution time)
1798-
await asyncio.sleep(millis_to_seconds(1000 - 900 + 120 + 200 + 20))
1798+
await asyncio.sleep(millis_to_seconds(1000 - 500 + 120 + 200 + 20))
17991799
calls = send_mock.mock_calls
18001800
assert len(calls) == 1
18011801
outgoing = send_mock.call_args[0][0]

0 commit comments

Comments
 (0)