Repository navigation
test: fix flaky backend cache timing - #538
Merged
Merged
Conversation
Retries after failed registry reads count from the end of the read, so the gap between the last read start and the next read exceeds RETRY_INTERVAL by the read time. Bound the next read by clock reads taken before and after the call instead of comparing with approx. Closes #537 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR updates the backend cache test to account for retries being scheduled at the end of a failed read, using monotonic-clock bounds instead of comparing timestamps with pytest.approx. This is a test-only change that removes timing flakiness without altering cache behavior. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #538 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 55 55
Lines 6667 6667
=========================================
Hits 6667 6667
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
uniqueg
marked this pull request as ready for review
October 27, 2026 00:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_cachecomparedcache._next_read - cache._last_readwithpytest.approx(RETRY_INTERVAL). After a failed read, the retry counts from the end of the read, while_last_readis its start, so the gap exceedsRETRY_INTERVALby the read time and failed on slow runners (30.000030635 vs 30 ± 3e-05 on "Test (Python 3.15, lowest dependencies)").The test now reads the clock before and after the call and checks that the next read lies between
start + RETRY_INTERVALandend + RETRY_INTERVAL, which is exact and timing-independent. No otherpytest.approxon clock differences exists in the tests.Closes #537
Verification
pytest tests/plugins: 405 passed, 20 of 20 repeated runspytest -m "not mongodb": 2836 passed, 1 skipped, 131 deselectedruff check,ruff format --check,mypy: cleanCI passedand both lowest-dependency test jobsReview
Light lane: test-only change of one assertion, no behaviour or CI change; diff reviewed by hand.
🤖 Generated with Claude Code
Summary by Sourcery
Stabilize the backend cache retry timing test by making its assertion independent of the duration of failed reads.
Bug Fixes:
Tests: