From cb4fd4185b21fba67e2ee14f813e5d7188d2b563 Mon Sep 17 00:00:00 2001 From: catborise Date: Mon, 9 Nov 2026 16:44:25 +0300 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea --- operations/tests/test_worker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/operations/tests/test_worker.py b/operations/tests/test_worker.py index e53758e8..a5baaf78 100644 --- a/operations/tests/test_worker.py +++ b/operations/tests/test_worker.py @@ -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))