Tests: increased subprocess timeout on Unit exit.
Also changed order of subprocess status checks. _terminate_process() method removed.
This commit is contained in:
@@ -240,24 +240,24 @@ class TestUnit(unittest.TestCase):
|
|||||||
break
|
break
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
self._p.join(timeout=5)
|
||||||
|
|
||||||
|
if self._p.is_alive():
|
||||||
|
self._p.terminate()
|
||||||
|
self._p.join(timeout=5)
|
||||||
|
|
||||||
|
if self._p.is_alive():
|
||||||
|
self.fail("Could not terminate process " + str(self._p.pid))
|
||||||
|
|
||||||
if os.path.exists(self.testdir + '/unit.pid'):
|
if os.path.exists(self.testdir + '/unit.pid'):
|
||||||
exit("Could not terminate unit")
|
self.fail("Could not terminate unit")
|
||||||
|
|
||||||
self._started = False
|
self._started = False
|
||||||
|
|
||||||
self._p.join(timeout=1)
|
if self._p.exitcode:
|
||||||
self._terminate_process(self._p)
|
self.fail(
|
||||||
|
"Child process terminated with code " + str(self._p.exitcode)
|
||||||
def _terminate_process(self, process):
|
)
|
||||||
if process.is_alive():
|
|
||||||
process.terminate()
|
|
||||||
process.join(timeout=5)
|
|
||||||
|
|
||||||
if process.is_alive():
|
|
||||||
exit("Could not terminate process " + process.pid)
|
|
||||||
|
|
||||||
if process.exitcode:
|
|
||||||
exit("Child process terminated with code " + str(process.exitcode))
|
|
||||||
|
|
||||||
def _check_alerts(self, log):
|
def _check_alerts(self, log):
|
||||||
found = False
|
found = False
|
||||||
|
|||||||
Reference in New Issue
Block a user