Repository navigation
test(jobs): job tests await their runs and each other's exclusions instead of sleeping - #694
Open
PiquelChips wants to merge 1 commit into
Open
PiquelChips wants to merge 1 commit into
PiquelChips wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
PiquelChips
force-pushed
the
test/jobs-waits
branch
from
November 22, 2026 14:33
84252d6 to
b7820f6
Compare
PiquelChips
force-pushed
the
test/audit-waits
branch
from
November 22, 2026 14:34
9c8edb3 to
12b23ce
Compare
…stead of sleeping
PiquelChips
force-pushed
the
test/audit-waits
branch
from
November 22, 2026 14:51
12b23ce to
8fdd92e
Compare
PiquelChips
force-pushed
the
test/jobs-waits
branch
from
November 22, 2026 14:51
b7820f6 to
e10c34c
Compare
PiquelChips
marked this pull request as ready for review
November 22, 2026 14:55
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.
The job runner's tests polled a counter and a log every 5 to 20ms. Its exclusivity test went further: it held its lock for a fixed 100ms and hoped the other runner would try to take it in that time. Each one now awaits the event it is waiting for. The exclusivity test now proves that every run kept the other runner out, where before it only hoped so.
Stacked on #693.
Changes
ExclusiveJobgets a#[cfg(test)] fn excluded(&self) {}hook. The runner calls it whenever it finds another replica running the job. It does not exist outside tests.Logkeeps its events in awatchchannel, so waiting on it is an await rather than a poll.Tests
a_panicking_run_releases_its_lock_and_the_job_runs_again: the runs are counted in awatch, and the test awaits the second run, where it used to poll anAtomicU32.runners_never_overlap_and_a_dropped_holder_hands_over:Heldholds its lock until the other runner has been excluded at least once since the run started (or until shutdown), where it used to sleep 100ms. The test then checks the same things on the run events, with exclusions filtered out. Checked: withtry_exclusivealways succeeding, the test fails with[Started(0), Started(1)].cleanup_that_keeps_falling_behind_raises_its_alertandcleanup_that_keeps_failing_raises_its_alert: they wait for cleanup's lock withDatabase::exclusiveand drop thecleanup_lockpolling helper.I ran the 6 jobs tests five times against a scratch cluster, and they passed every time.
Council review
Rounds: 3
GPT 6.1 Sol could not take part: its account hit its usage limit.
Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 and Claude Fable 5.2 (via T3 Code)