From b988951e1767a24161c721f88139e20cada68c23 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Tue, 22 Sep 2026 10:59:11 -0600 Subject: [PATCH] test(vaults): widen the timing margin in the parallel retry test --- tests/core/test_vault_bad_keys.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/core/test_vault_bad_keys.py b/tests/core/test_vault_bad_keys.py index 8274351e..1ff8df96 100644 --- a/tests/core/test_vault_bad_keys.py +++ b/tests/core/test_vault_bad_keys.py @@ -232,14 +232,17 @@ def test_retry_takes_the_next_parallel_answer_without_a_new_request(tmp_path: Pa from tests.core.test_vaults_lookup import FakeVault local = SQLite("local", tmp_path / "local.db") - fast = FakeVault("fast", BAD, delay=0.01) - slow = FakeVault("slow", GOOD, delay=0.2) + # the fast answer must land after the slow query has started, or the pool shutdown cancels + # the slow query before it runs and it never reaches candidates; a loaded CI runner can take + # tens of milliseconds to start the second worker thread + fast = FakeVault("fast", BAD, delay=0.1) + slow = FakeVault("slow", GOOD, delay=0.3) vaults = Vaults("SVC") vaults.vaults = [local, fast, slow] assert vaults.get_key(KID) == (BAD, fast) vaults.flag_bad_key(KID, BAD) - time.sleep(0.4) # the slow answer lands in candidates after the first call returned + time.sleep(0.5) # the slow answer lands in candidates after the first call returned assert vaults.get_key(KID) == (GOOD, slow) assert fast.calls == 1 and slow.calls == 1