tests: kill worker pids as well on timeouts

Workers that don't exit can also trigger a timeout, and we want our
test environment to be super robust - kill them aggressively too.

Also raise the timeout error so that we don't mask this when it
happens.

Change-Id: Iee606720f98e9a5e8a11f162eb885c0a00a2345e
Partial-Bug: #1357578
This commit is contained in:
Robert Collins 2014-09-19 10:14:48 +12:00
parent f804ce594a
commit 4acf31fb3a
1 changed files with 8 additions and 4 deletions

View File

@ -105,10 +105,9 @@ class MultiprocessWSGITest(integrated_helpers._IntegratedTestBase):
self.pid)
os.kill(self.pid, signal.SIGTERM)
self._wait_for_all_workers_to_end()
try:
# Make sure we reap our test process
self._wait_for_all_workers_to_end()
self._reap_test()
except fixtures.TimeoutException:
# If the child gets stuck or is too slow in exiting
@ -117,9 +116,14 @@ class MultiprocessWSGITest(integrated_helpers._IntegratedTestBase):
# to do this otherwise the child process can hold up
# the test run
LOG.warn("got fixtures.TimeoutException during tearDown(). "
"going nuclear with a SIGKILL on launcher pid %d.",
self.pid)
"going nuclear with SIGKILL.")
for worker_pid in self._get_workers():
LOG.warn("worker pid %d" % worker_pid)
os.kill(worker_pid, signal.SIGKILL)
LOG.warn("parent pid %d" % self.pid)
os.kill(self.pid, signal.SIGKILL)
raise
super(MultiprocessWSGITest, self).tearDown()