Repository navigation
🤖 test: check the promote deadlines without the wall clock - #361
Merged
Merged
Conversation
Change-Id: Iaf2f1f696f5fc2a8be4a8f239c242638a48ce9f5 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 14, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 14, 2026
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 promote timing tests in
internal/aggregated/storageno longer fail when the test process stalls. Each time check now reads only the deadlines that the storage sets on its requests, never the test's wall clock. This PR changes only tests. It adds no production change and no production seam.Fixes #354
Cause
The container's CPU cgroup has a quota of 32 CPUs per 100 ms period (
cpu.max 3200000 100000). On this host it was throttled in 31 % of all periods (cpu.stat: 15,942 of 51,410). Memory was at 64.0 of 64 GiB, so reclaim stalls also happen. A throttled cgroup stops the whole test process while wall time goes on. Two checks could not survive that:TestTemplatePromoteConfirmation/timeout_{before,after}_applyfailed when the promotion took more than 1 s of wall time ("promotion waited 1.05s for a slow activation; the PATCH budget is 50ms").TestTemplatePromoteDeadline/slow_re-read_ends_before_the_deadlinegave the storage 200 ms of wall time between the re-read deadline and the request deadline ("the storage answered after the request deadline"). It also needed the lookups to finish within 400 ms, and it slept 3 s in the fake.Change
holdPatchTransportnow gets the PATCH budget. Before it sends the PATCH, it checks that the PATCH context has a deadline at most that budget away. Time only shortens the remaining budget, so a stall cannot fail this check. A PATCH without the budget still fails it, because only the client's 30 s timeout bounds it.time.Afterfallback. It waits for the PATCH deadline, which the check above proved is set.problemschannel, and the test reads that channel.elapsed > 1scheck is gone.rereadDeadlineTransportrecords the deadline of the confirming re-read (GET /api/v2/templates/{id}) and fails the re-read at once withcontext.DeadlineExceeded.promoteFault.rereadDelayand its real 3 s sleep are removed. Nothing else used them.Other tests in the file keep their real waits.
TestTemplatePromoteEmitsNoTemplateWatchEventwaits 200 ms for an event that must not come, and a stall cannot make it fail.Reproduction and results
Each row is one run of
TestTemplatePromote(Confirmation|Deadline)with-count=50: 100 test runs, at host load 30 to 157.78c29687)e86206bf)go test ./internal/controller/...taskset)SIGSTOPfor 1.2 s, then runs 0.5 s, in a loopPlain host load did not reproduce the flake, because Linux's fair scheduler gives these few-millisecond tests their slices. Stalls of the whole process reproduce both failure messages from the #352 run. The stall script stops only the test PID that it started, and it always sends
SIGCONTon exit.The fixed tests also run faster: 3 s instead of 2.5 minutes for
-count=50under load. They no longer wait for real deadlines.Validation
WithCancelinstead ofWithTimeout): bothtimeoutcases fail on "the PATCH deadline (set: true) is not within the PATCH budget 50ms".make verify-vendor,make build,make lint,make testpass.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$89.72