test: Deflake Redis RQ metadata timestamp test with a controlled clock - #2200
Open
vdusek wants to merge 1 commit into
Open
test: Deflake Redis RQ metadata timestamp test with a controlled clock#2200vdusek wants to merge 1 commit into
vdusek wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2200 +/- ##
==========================================
+ Coverage 93.72% 93.73% +0.01%
==========================================
Files 181 181
Lines 12825 12825
==========================================
+ Hits 12020 12022 +2
+ Misses 805 803 -2
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:
|
vdusek
marked this pull request as ready for review
August 28, 2026 11:48
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.
test_metadata_file_updatesintests/unit/storage_clients/_redis/test_redis_rq_client.pyfailed on Windows / Python 3.12 withassert accessed_at > accessed_aton identical timestamps (run).The Redis
is_empty()never stampsaccessed_at, andget_metadata()reads the record before stamping its own access. The two values the test compared were therefore the stamps of two back-to-backget_metadata()calls (the fixture's purge check and the test's first call), about a millisecond apart, with theasyncio.sleep(0.01)sitting after both. On Windows before Python 3.13,datetime.now()ticks at 1–15.6 ms, so the stamps collide.The test now drives the mixin's clock through a
Mock, uses a read the Redis client does treat as an access (fetch_next_request()), and asserts the exact stamps – no sleeps, no wall clock. Removing theaccessed_atupdate fromfetch_next_request()makes it fail, so it still guards the behaviour.Locally, quantizing the mixin clock to 15.625 ms ticks reproduced the failure 18/20 times (2/40 at 1 ms); the new test passes 20/20 and 40/40 under the same clocks, and the Redis test directory passes 20/20 with
-n auto.Note:
is_empty()bumpsaccessed_atin the memory and file-system clients but not in the Redis one. Left as is here; worth deciding separately whether that's intended.✍️ Drafted by Claude Code