Skip to content

fix(tests): Fix flaky test_issue_owners_should_ratelimit#108663

Merged
joshuarli merged 1 commit intomasterfrom
fix/flaky-test-post-process-ratelimit
Feb 20, 2026
Merged

fix(tests): Fix flaky test_issue_owners_should_ratelimit#108663
joshuarli merged 1 commit intomasterfrom
fix/flaky-test-post-process-ratelimit

Conversation

@joshuarli
Copy link
Copy Markdown
Member

Summary

  • Fix flaky test_issue_owners_should_ratelimit in post_process tests
  • The test uses datetime.now() for cache window_start values, and the production code uses datetime.now() to calculate cache timeouts via max(60 - elapsed, 0). In slow CI runs, elapsed time can exceed 60s, causing cache entries to expire immediately
  • Added @freeze_time() to ensure consistent time between cache setup and rate limit checks

Fixes #108655

Test plan

  • pytest tests/sentry/tasks/test_post_process.py::PostProcessGroupErrorTest::test_issue_owners_should_ratelimit passes

…time

The test uses datetime.now() for cache window_start values, and the
production code uses datetime.now() to calculate cache timeouts via
max(60 - elapsed, 0). In slow CI runs, elapsed time can exceed 60s,
causing cache entries to expire with timeout=0, which makes the rate
limit check fail to find the expected data.

Freezing time ensures consistent behavior regardless of test execution
speed.

Fixes #108655
@joshuarli joshuarli requested a review from a team as a code owner February 20, 2026 04:24
@joshuarli joshuarli merged commit a2d7f3b into master Feb 20, 2026
77 checks passed
@joshuarli joshuarli deleted the fix/flaky-test-post-process-ratelimit branch February 20, 2026 18:13
priscilawebdev pushed a commit that referenced this pull request Feb 24, 2026
## Summary
- Fix flaky `test_issue_owners_should_ratelimit` in post_process tests
- The test uses `datetime.now()` for cache window_start values, and the
production code uses `datetime.now()` to calculate cache timeouts via
`max(60 - elapsed, 0)`. In slow CI runs, elapsed time can exceed 60s,
causing cache entries to expire immediately
- Added `@freeze_time()` to ensure consistent time between cache setup
and rate limit checks

Fixes #108655

## Test plan
- [x] `pytest
tests/sentry/tasks/test_post_process.py::PostProcessGroupErrorTest::test_issue_owners_should_ratelimit`
passes
mchen-sentry pushed a commit that referenced this pull request Feb 24, 2026
## Summary
- Fix flaky `test_issue_owners_should_ratelimit` in post_process tests
- The test uses `datetime.now()` for cache window_start values, and the
production code uses `datetime.now()` to calculate cache timeouts via
`max(60 - elapsed, 0)`. In slow CI runs, elapsed time can exceed 60s,
causing cache entries to expire immediately
- Added `@freeze_time()` to ensure consistent time between cache setup
and rate limit checks

Fixes #108655

## Test plan
- [x] `pytest
tests/sentry/tasks/test_post_process.py::PostProcessGroupErrorTest::test_issue_owners_should_ratelimit`
passes
@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test: tests/sentry/tasks/test_post_process.py::PostProcessGroupErrorTest::test_issue_owners_should_ratelimit

2 participants