Skip to content

Tests: the rate tests no longer depend on how fast the loop runs - #85

Merged
Dyotson merged 2 commits into
mainfrom
fix-84-rate-tests
Nov 24, 2026
Merged

Dyotson merged 2 commits into
mainfrom
fix-84-rate-tests

Conversation

@Dyotson

@Dyotson Dyotson commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #84

The tests that send a burst and expect drops let the token bucket refill by wall-clock time, so a slow runner could refill it mid-burst and nothing was dropped. These tests now hold the refill rate at about zero while the burst is sent. The limits and burst sizes are unchanged, and the "another flow is not affected" check now runs under the same held refill, so a shared bucket would show.

Tests changed: header datagrams count against the flow's rate (test_proxy_protocol), untrusted packet rate per player via proxy and the proxy players' relay budget (test_proxy), and two sign-in burst tests that counted accepted hellos against a refilling bucket (test_proxy, test_auth_limits).

Checked on a slowed process (3 rate tests, 100 runs each): before, 49 failures with a stop/continue pauser and 13 with six busy loops at nice 19; after, 0 and 0. Mutation: with the drop logic removed in a scratch copy, the three burst tests fail. Full suite passes on Python 3.12 and 3.14 (1271 tests).

…he loop runs (#84)

The tests that send a burst and expect a drop let the bucket refill by wall-clock
time, so a slow runner could refill it mid-burst. They now hold the refill rate
at about zero while the burst is sent; the limits and the burst size are unchanged.
@Dyotson Dyotson self-assigned this Nov 24, 2026
@Dyotson
Dyotson merged commit 1746f40 into main Nov 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test that fails at random: UdpTest.test_header_datagrams_count_against_the_flows_rate

1 participant