mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-19 23:33:37 -05:00
TestAutoScaling wait for process to stop
This commit is contained in:
@@ -235,6 +235,7 @@ class TestAutoScaling:
|
|||||||
assert len(self.pool) == 10
|
assert len(self.pool) == 10
|
||||||
assert self.pool.workers[0].messages_sent == 2
|
assert self.pool.workers[0].messages_sent == 2
|
||||||
|
|
||||||
|
@pytest.mark.timeout(20)
|
||||||
def test_lost_worker_autoscale(self):
|
def test_lost_worker_autoscale(self):
|
||||||
# if a worker exits, it should be replaced automatically up to min_workers
|
# if a worker exits, it should be replaced automatically up to min_workers
|
||||||
self.pool.init_workers(ResultWriter().work_loop, multiprocessing.Queue())
|
self.pool.init_workers(ResultWriter().work_loop, multiprocessing.Queue())
|
||||||
@@ -243,8 +244,8 @@ class TestAutoScaling:
|
|||||||
assert len(self.pool) == 2
|
assert len(self.pool) == 2
|
||||||
assert not self.pool.should_grow
|
assert not self.pool.should_grow
|
||||||
alive_pid = self.pool.workers[1].pid
|
alive_pid = self.pool.workers[1].pid
|
||||||
self.pool.workers[0].process.terminate()
|
self.pool.workers[0].process.kill()
|
||||||
time.sleep(2) # wait a moment for sigterm
|
self.pool.workers[0].process.join() # waits for process to full terminate
|
||||||
|
|
||||||
# clean up and the dead worker
|
# clean up and the dead worker
|
||||||
self.pool.cleanup()
|
self.pool.cleanup()
|
||||||
|
|||||||
Reference in New Issue
Block a user