Repository navigation
test: keep scheduled retention out of the caller prune test - #86
Merged
Merged
Conversation
runtime.run starts a retention pass at once, because the test kept the default retention interval. When that pass ran after the test backdated stopped_at_ms, it deleted the caller row first, and the test's own prune returned 0 instead of 1. It failed once on PostgreSQL 14 in CI, about 2 in 600 runs locally under load. The case now turns the retention schedule off, as wake-up, polling-loop, and background-pickup tests do. A spy holds any scheduled retention pass until the backdate is done, so a scheduled pass would fail the test every time instead of rarely. The spy made the old test fail with the CI message before this change.
[Low impact] The PR appears safe to merge. SummaryThis test-only change keeps automatic retention from racing the caller recovery test.
Reviews (1) · Last reviewed commit: "test: keep scheduled retention out of th..." · Reviewed by Greptile |
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.
Summary
test/caller-lifecycle.test.ts"recovers a pruned caller registration after runtime shutdown" failed once on PostgreSQL 14 in CI (run 39177376400), withexpected +0 to be 1at the manualretention.prune({ target: "processes" }).retentionIntervalMilliseconds, soruntime.runstarted a scheduled retention pass at once (src/runtime.ts,MaintenanceScheduler). When that pass ran after the test backdatedstopped_at_ms, it deleted the caller row first. The library behaved correctly.setup({ retentionIntervalMilliseconds: 0 }), aswake-up,polling-loop, andbackground-pickuptests do.repository.pruneRetentionholds any scheduled pass until the backdate is done. Before the fix it made the test fail with the CI message every time. After the fix no scheduled pass starts, and the spy stays as a guard.Checks
pnpm run checkandpnpm testpass (704 passed, 32 skipped).