Skip to content

fix(tests): Fix flaky test_impersonation_enforces_rate_limits_when_disabled timing#109095

Open
joshuarli wants to merge 1 commit intomasterfrom
fix/flaky-test-impersonation-rate-limit-timing
Open

fix(tests): Fix flaky test_impersonation_enforces_rate_limits_when_disabled timing#109095
joshuarli wants to merge 1 commit intomasterfrom
fix/flaky-test-impersonation-rate-limit-timing

Conversation

@joshuarli
Copy link
Member

Summary

  • Wrap the test in freeze_time("2000-01-01") to prevent the 1-second rate limit window from expiring between middleware calls
  • Without frozen time, the rate limit window (SENTRY_IMPERSONATION_RATE_LIMIT=1, which normalizes to 1 req/1s window) can expire if the test runs slowly, causing the 3rd call to not be rate limited

Test plan

  • Test passes 10/10 consecutive local runs

Fixes #109043

…sabled timing

Wrap the test in freeze_time to prevent the 1-second rate limit window
from expiring between middleware calls, which caused non-deterministic
rate limiting behavior.

Fixes #109043
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant