Repository navigation
test: give the outcome deadline test its whole deadline - #512
Merged
Merged
Conversation
test_absolute_deadline_reaps_reader_that_suppresses_cancellation built the controller with a 10 ms deadline and the real monotonic clock. _observe subtracts the time since registration from the deadline before its first read, so a runner that started the worker more than 10 ms late marked the deadline elapsed without ever calling the reader, and the test waited 30 s for a start that never came. It failed twice in a row on Windows in #509's CI. The test now freezes the controller's clock, so the run gets its whole deadline however late it starts, and uses a 0.5 s deadline, which the run's real asyncio timeout still enforces with room for the read task to start on a coarse Windows timer. It still proves the absolute deadline reaps a reader that suppresses cancellation. Closes #511. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approved
No active review issues were identified for the test-only Windows timing adjustment.
No open issues 🎉
What changed in this PR
This test-only change addresses the Windows timing race in #511 by giving the deployment outcome observer its full deadline regardless of worker startup delay. Production behavior is unchanged.
Changes:
- Freeze the controller’s clock and increase the test deadline from 10 ms to 500 ms.
- Retain the real
asynciotimeout to verify that the deadline reaps a reader that suppresses cancellation. - Explain the timing adjustment in an inline comment.
| File | Description |
|---|---|
tests/ui/test_deployment_outcome_controller.py |
Adjust the clock and deadline to stabilize the cancellation test on Windows. |
Review effort: Balanced
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.
Closes #511
Summary
test_absolute_deadline_reaps_reader_that_suppresses_cancellationfailed twice in a row on Windows in #509's CI, in code #509 does not touch.DeploymentOutcomeController._observesubtracts the time since registration from the deadline before its first read. A runner that started the worker more than 10 ms late therefore marked the deadline elapsed without ever calling the reader, and the test waited 30 s forstarted.clock=lambda: 0.0), so the run gets its whole deadline however late its worker starts. It usesdeadline_seconds=0.5, which the run's realasyncio.timeoutstill enforces, leaving room for the read task to start on a coarse Windows timer (about 15 ms).INCOMPLETEwith a deadline summary.Production is unaffected; the default deadline is 300 s.
Verification
deadline_seconds=0.01) and a clock that moves 20 ms on between registration and the worker running, the reader is never called andstarted.wait()times out. That is the CI failure.uv run pytest -p no:tach tests/ui/test_deployment_outcome_controller.py -k absolute_deadline_reaps -q: passed 5 runs in a row, about 0.8 s each.uv run pytest -p no:tach -n 8 tests/ui/test_deployment_outcome_controller.py -q: 35 passed.TimeoutError.ruff check,ruff format --checkandmypyon the test file: clean.Checklist
make checkpasses locally. (Test-only change. The affected file and lint/type checks were run; the full suite runs in CI.)and a fail-closed audit entry, and sensitive reads are still masked.