Browse Source

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
tags/2014.2.rc1
Robert Collins 5 years ago
parent
commit
4acf31fb3a
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      nova/tests/integrated/test_multiprocess_api.py

+ 8
- 4
nova/tests/integrated/test_multiprocess_api.py View File

@@ -105,10 +105,9 @@ class MultiprocessWSGITest(integrated_helpers._IntegratedTestBase):
105 105
                      self.pid)
106 106
             os.kill(self.pid, signal.SIGTERM)
107 107
 
108
-            self._wait_for_all_workers_to_end()
109
-
110 108
             try:
111 109
                 # Make sure we reap our test process
110
+                self._wait_for_all_workers_to_end()
112 111
                 self._reap_test()
113 112
             except fixtures.TimeoutException:
114 113
                 # If the child gets stuck or is too slow in exiting
@@ -117,9 +116,14 @@ class MultiprocessWSGITest(integrated_helpers._IntegratedTestBase):
117 116
                 # to do this otherwise the child process can hold up
118 117
                 # the test run
119 118
                 LOG.warn("got fixtures.TimeoutException during tearDown(). "
120
-                         "going nuclear with a SIGKILL on launcher pid %d.",
121
-                         self.pid)
119
+                         "going nuclear with SIGKILL.")
120
+                for worker_pid in self._get_workers():
121
+                    LOG.warn("worker pid %d" % worker_pid)
122
+                    os.kill(worker_pid, signal.SIGKILL)
123
+
124
+                LOG.warn("parent pid %d" % self.pid)
122 125
                 os.kill(self.pid, signal.SIGKILL)
126
+                raise
123 127
 
124 128
         super(MultiprocessWSGITest, self).tearDown()
125 129
 

Loading…
Cancel
Save