Skip to content

test(cache): cover a late 304 and widen the stale margin - #20

Merged
jamiehdev merged 1 commit into
mainfrom
test/revalidation-gaps
Sep 27, 2026
Merged

jamiehdev merged 1 commit into
mainfrom
test/revalidation-gaps

Conversation

@jamiehdev

Copy link
Copy Markdown
Owner

Tests only. A new test covers the case where a background revalidation gets a 304 after a no-cache request has stored a newer response. The newer entry must stay. The stale-while-revalidate test now has a wider timing margin, so a loaded CI runner cannot flake it.

Changes

  • late_not_modified_leaves_a_newer_entry_in_place delays the 304 by 2 s and waits on origin requests and the revalidations counter, not on sleeps.
  • stale_while_revalidate_serves_stale_and_refreshes_in_the_background uses a 3 s origin delay and a 1 s bound. The old values were 500 ms and 400 ms.

Verification

  • With the Arc::ptr_eq check in Store::freshen removed, the new test fails: the next hit carries the old "v1" ETag.
  • With while_revalidating forced to revalidate before it answers, the stale test fails its elapsed-time assertion.
  • Both tests passed 20 runs in a row.

@jamiehdev
jamiehdev merged commit a762c44 into main Sep 27, 2026
2 checks passed
@jamiehdev
jamiehdev deleted the test/revalidation-gaps branch September 27, 2026 16:41
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