mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-14 21:15:06 +00:00
test(vaults): widen the timing margin in the parallel retry test
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user