Skip to content

test: make retention timing assertions deterministic - #40

Merged
mcollina merged 1 commit into
mainfrom
fix/flaky-retention-timing
Nov 6, 2026
Merged

mcollina merged 1 commit into
mainfrom
fix/flaky-retention-timing

Conversation

@mcollina

@mcollina mcollina commented Nov 6, 2026

Copy link
Copy Markdown
Member

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 createdAt values 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.

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.
@mcollina
mcollina merged commit 35cbcb2 into main Nov 6, 2026
19 checks passed
@mcollina
mcollina deleted the fix/flaky-retention-timing branch November 6, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant