From a829c07aec92dda4f2dc0175a0632594954e4ced Mon Sep 17 00:00:00 2001 From: Thomas Steinacher Date: Wed, 24 Apr 2024 12:31:53 +0100 Subject: [PATCH] Also test task locks & queue locks --- tests/test_workers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_workers.py b/tests/test_workers.py index 4288812..7f5fe5d 100644 --- a/tests/test_workers.py +++ b/tests/test_workers.py @@ -188,7 +188,8 @@ def test_handles_timeout(self, tiger, ensure_queues): ensure_queues(error={"default": 1}) def test_heartbeat(self, tiger): - task = Task(tiger, sleep_task) + # Test both task heartbeat and lock renewal. + task = Task(tiger, sleep_task, lock=True) task.delay() # Start a worker and wait until it starts processing. @@ -196,7 +197,11 @@ def test_heartbeat(self, tiger): target=external_worker, kwargs={ "patch_config": {"ACTIVE_TASK_UPDATE_TIMER": DELAY / 2}, - "worker_kwargs": {"executor_class": SyncExecutor}, + "worker_kwargs": { + # Test queue lock. + "max_workers_per_queue": 1, + "executor_class": SyncExecutor, + }, }, ) worker.start()