Skip to content

test: make cache TTL expiry deterministic - #13

Merged
fxdv merged 1 commit into
mainfrom
fix/deterministic-cache-ttl-test
Jul 23, 2026
Merged

test: make cache TTL expiry deterministic#13
fxdv merged 1 commit into
mainfrom
fix/deterministic-cache-ttl-test

Conversation

@fxdv

@fxdv fxdv commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Root cause

Post-merge main CI for the v0.1.4 VERSION commit failed in TestTTLExpiry: https://github.com/fxdv/patchlog/actions/runs/30047779586

The test used a 100 ms wall-clock TTL. Cache.Set performs an atomic durable write, so a slow CI filesystem could consume the TTL before the immediate Get, producing a false failure.

Fix

  • use a one-minute live TTL for the immediate-hit assertion;
  • rewrite the serialized test entry with an explicit timestamp two minutes in the past;
  • assert expiry without sleeping or depending on scheduler/filesystem latency.

Production cache behavior is unchanged.

Evidence

  • TestTTLExpiry, Go 1.26.5, -count=100: green;
  • TestTTLExpiry, supported Go 1.22.12, -count=100: green;
  • bash scripts/gate.sh: 8/8 green when loopback listeners are allowed.

No v0.1.4 tag was created. Finalization remains blocked until this PR is merged and post-merge main CI is green on the new exact commit.

@fxdv
fxdv merged commit 654bc2d into main Jul 23, 2026
2 checks passed
@fxdv
fxdv deleted the fix/deterministic-cache-ttl-test branch July 23, 2026 21:59
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