From af3ab50a115d4c516f2fbeee769071ec454c88ff Mon Sep 17 00:00:00 2001 From: hellices Date: Fri, 30 Oct 2026 07:52:25 +0900 Subject: [PATCH] test: give the outcome deadline test its whole deadline 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> --- tests/ui/test_deployment_outcome_controller.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/ui/test_deployment_outcome_controller.py b/tests/ui/test_deployment_outcome_controller.py index 04d513851..23a8147b0 100644 --- a/tests/ui/test_deployment_outcome_controller.py +++ b/tests/ui/test_deployment_outcome_controller.py @@ -901,7 +901,12 @@ async def snapshot(self, namespace: str, name: str) -> RawDeploymentOutcomeSnaps reaped.set() raise AssertionError("unreachable") - controller, ui = _controller(HungReader(), deadline_seconds=0.01) + # A frozen clock gives the run its whole deadline however late its worker + # starts (#511): with the real one, a runner slower than the deadline + # marked it elapsed before the reader was ever called. The deadline is + # still enforced by the run's real asyncio timeout, so it must outlast the + # read task's start on a coarse Windows timer. + controller, ui = _controller(HungReader(), deadline_seconds=0.5, clock=lambda: 0.0) observer = controller.scale_observer( epoch=4, namespace="default",