You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(auth): the rate-limit deadline test passes on a busy machine #658
security::tests::rate_limits::rate_limit_deadline_includes_a_blocked_database_query (apps/auth-service/src/security/tests/rate_limits.rs:11) fails when the machine is busy.
The test sets the request deadline to 1 second (policy.request_timeout), holds the rate-limit bucket's lock and expects a 504. It then releases the lock and expects the next request to get a 202 within the same 1-second deadline. On a loaded machine that second request takes longer than a second and gets a 504, so the test fails. The rate limiter is working correctly; only the test fails.
Reproduce
Run the test alone with the machine's load average around 130 to 170:
just db test -E 'test(rate_limit_deadline_includes_a_blocked_database_query)'
It failed once in four runs on a #654 checkout, and once in the full just db test. It passed the one time it ran on main (load average about 130). Nothing in #654 touches the rate limiter.
Expected
The test passes however busy the machine is, without being skipped. For example, the second request could use a longer deadline: the test only needs the first request's deadline to be short.
Activity