test(vaults): widen the timing margin in the parallel retry test

This commit is contained in:
imSp4rky
2026-09-22 10:59:11 -06:00
parent 4639d9d496
commit b988951e17
+6 -3
View File
@@ -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 from tests.core.test_vaults_lookup import FakeVault
local = SQLite("local", tmp_path / "local.db") local = SQLite("local", tmp_path / "local.db")
fast = FakeVault("fast", BAD, delay=0.01) # the fast answer must land after the slow query has started, or the pool shutdown cancels
slow = FakeVault("slow", GOOD, delay=0.2) # 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("SVC")
vaults.vaults = [local, fast, slow] vaults.vaults = [local, fast, slow]
assert vaults.get_key(KID) == (BAD, fast) assert vaults.get_key(KID) == (BAD, fast)
vaults.flag_bad_key(KID, BAD) 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 vaults.get_key(KID) == (GOOD, slow)
assert fast.calls == 1 and slow.calls == 1 assert fast.calls == 1 and slow.calls == 1