From 040955ebf27914ebe06e8a8bcffe3251dabfcfef Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 14 Aug 2026 22:39:33 +0200 Subject: [PATCH] fix(ci): widen the headroom test's timing margin 67b6072bb tightened this test's assertion from "Skipping distro|budget exhausted" to the headroom line alone, and in the same change shrank the command and budget from sleep 3 / 5s to sleep 2 / 3s. That left the branch reachable only when the first iteration measures exactly 2s. distros.sh times with `date +%s`, whole seconds, so a measured duration carries up to a second of boundary rounding on top of bash startup and two `source scripts/meta/env/load.sh`. Run 31823654078 booked `sleep 2` as 3s, took the `remaining <= 0` branch instead, and never printed the line the test greps for: >>> Duration: distro=debian took 3s (max_seen=3s) [WARN] Global budget exhausted (remaining=0s). Stopping further distro runs. It is a race and not a defect in the script: on the same commit manjaro and centos both passed base/06_test.sh and moved on to 07_console.sh, and only ubuntu lost it, twice within the one job. Reaching the branch needs d < B < 2.15*d for a measured first duration d. At 2 / 3s the window admitted d=2 alone. At 4 / 7s it admits 4, 5 and 6 - three seconds of slack against the one second CI actually overshot by. The assertion is unchanged, so the branch is still genuinely exercised rather than relaxed, and the suite pays two more seconds. Co-Authored-By: Claude Opus 5 (1M context) --- tests/unit/scripts/tests/deploy/test_distros.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/scripts/tests/deploy/test_distros.py b/tests/unit/scripts/tests/deploy/test_distros.py index 36234c8cae..cbb5afe930 100644 --- a/tests/unit/scripts/tests/deploy/test_distros.py +++ b/tests/unit/scripts/tests/deploy/test_distros.py @@ -112,8 +112,8 @@ class TestDistrosLoop(unittest.TestCase): def test_a_distro_needs_the_slowest_run_plus_headroom_to_start(self) -> None: proc, record = self._run( DISTROS, - 'sleep 2\necho "${INFINITO_DISTRO}" >> "${RECORD}"', - INFINITO_CI_DISTRO_BUDGET_SECONDS="3", + 'sleep 4\necho "${INFINITO_DISTRO}" >> "${RECORD}"', + INFINITO_CI_DISTRO_BUDGET_SECONDS="7", ) self.assertEqual(proc.returncode, 0, proc.stderr) self.assertEqual(len(record.split()), 1)