Repository navigation
test: make retention timing assertions deterministic - #40
Merged
Merged
Conversation
The snapshot and L0 time-retention tests aged files with a fixed sleep(80/120) and then enforced retention against a tight 50ms wall-clock window. On a loaded CI runner the scheduler can delay the test past that window between a write and the enforce call, letting the newest file age across the cutoff and flaking the assertion (observed as an intermittent 'test (node 26)' failure). Instead of sleeping, drive the retention cutoff from the files' own createdAt values: read them, then pass an explicit time so the cutoff lands strictly between the older and newest files. The result is deterministic and independent of wall-clock or scheduler delay.
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.
Fixes an intermittent
test (node 26)CI failure caused by timing-sensitive retention tests.The snapshot and L0 time-retention tests aged files with a fixed
sleep(80/120)and then enforced retention against a tight 50ms wall-clock window. On a loaded CI runner the scheduler can delay the test past that window between a write and the enforce call, letting the newest file age across the cutoff and flaking the assertion.This removes the sleeps. The retention cutoff is now derived from the files' own
createdAtvalues and passed as an explicit time, so it lands deterministically between the older and the newest file. The result no longer depends on wall-clock or scheduler delay, so it cannot flake under CI load.