From 160508c907f674633c755def00dc18c403b26150 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Fri, 10 Mar 2023 15:51:28 -0500 Subject: [PATCH] TestAutoScaling wait for process to stop --- awx/main/tests/functional/test_dispatch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awx/main/tests/functional/test_dispatch.py b/awx/main/tests/functional/test_dispatch.py index 86e90e50a0..c93b6a7d6a 100644 --- a/awx/main/tests/functional/test_dispatch.py +++ b/awx/main/tests/functional/test_dispatch.py @@ -235,6 +235,7 @@ class TestAutoScaling: assert len(self.pool) == 10 assert self.pool.workers[0].messages_sent == 2 + @pytest.mark.timeout(20) def test_lost_worker_autoscale(self): # if a worker exits, it should be replaced automatically up to min_workers self.pool.init_workers(ResultWriter().work_loop, multiprocessing.Queue()) @@ -243,8 +244,8 @@ class TestAutoScaling: assert len(self.pool) == 2 assert not self.pool.should_grow alive_pid = self.pool.workers[1].pid - self.pool.workers[0].process.terminate() - time.sleep(2) # wait a moment for sigterm + self.pool.workers[0].process.kill() + self.pool.workers[0].process.join() # waits for process to full terminate # clean up and the dead worker self.pool.cleanup()