From 7090595658c2f931008fda62d612ea702509e930 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Sat, 23 Aug 2014 16:36:43 -0700 Subject: [PATCH] Make test_killed_worker_recover faster I3f7bd0ba5ef1bb716a97635252abe251053a669d changed how server.wait() works so that it wouldn't return until all children are done. But test_killed_worker_recover doesn't try to kill the children, unlike other tests in test_multiprocess_api. This didn't cause the unit test to fail because tearDown catches the unit test timeout, fixtures.TimeoutException, which triggers after 160 seconds. Now instead of taking 160 seconds test_killed_worker_recover, which is run twice, takes under 3 seconds. Change-Id: I8cbd08cb873cd81a65005764759ac9ca23fa6430 Closes-Bug: #1360719 --- nova/tests/integrated/test_multiprocess_api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nova/tests/integrated/test_multiprocess_api.py b/nova/tests/integrated/test_multiprocess_api.py index 0e68b96edb77..b302fd711f77 100644 --- a/nova/tests/integrated/test_multiprocess_api.py +++ b/nova/tests/integrated/test_multiprocess_api.py @@ -102,6 +102,8 @@ class MultiprocessWSGITest(integrated_helpers._IntegratedTestBase): # Make sure all processes are stopped os.kill(self.pid, signal.SIGTERM) + self._terminate_workers() + try: # Make sure we reap our test process self._reap_test() @@ -183,11 +185,14 @@ class MultiprocessWSGITest(integrated_helpers._IntegratedTestBase): flavors = self.api.get_flavors() self.assertTrue(len(flavors) > 0, 'Num of flavors > 0.') - worker_pids = self._get_workers() - LOG.info("sent launcher_process pid: %r signal: %r" % (self.pid, sig)) os.kill(self.pid, sig) + self._terminate_workers() + + def _terminate_workers(self): + worker_pids = self._get_workers() + # did you know the test framework has a timeout of its own? # if a test takes too long, the test will be killed. for pid in worker_pids: