1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

test(operations): the stuck-host cancel test waits for both hosts' hooks

The worker starts the cancel hooks of the two hosts in no set order. The
test waited only for the healthy host's hook and then counted the stuck
host's, which on a slow runner had not started yet (seen on Python 3.14
in CI): it now waits for both before it counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-09 16:44:25 +03:00
parent e6155c855a
commit cb4fd4185b

View file

@ -83,7 +83,8 @@ class WorkerTestCase(TransactionTestCase):
for op in [*stuck, healthy]:
jobs.cancel(op.pk, self.user)
# the other host's cancel goes through; the stuck host's second cancel waits for its first
self.assertTrue(wait_for(lambda: ("cancel", 2) in fakes.HOST_CALLS))
# (the hooks start in no set order: wait for both)
self.assertTrue(wait_for(lambda: ("cancel", 2) in fakes.HOST_CALLS and ("cancel", 1) in fakes.HOST_CALLS))
self.assertEqual(fakes.HOST_CALLS.count(("cancel", 1)), 1)
fakes.STUCK[1].set()
self.assertTrue(wait_for(lambda: fakes.HOST_CALLS.count(("cancel", 1)) == 2))