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
This commit is contained in:
Joe Gordon 2014-08-23 16:36:43 -07:00
parent e1f5d3c54b
commit 7090595658

View File

@ -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: