summaryrefslogtreecommitdiffhomepage
path: root/test/unit/main.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2019-10-08 00:28:40 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2019-10-08 00:28:40 +0300
commitfaf4ad54785fa418b3c218ab0d2d2016c55d169a (patch)
tree050534d1dbeacd70727e8fdb06077501ab9f086d /test/unit/main.py
parent1b4c96f2653abec40e23a3ce3b184195bb06e212 (diff)
downloadunit-faf4ad54785fa418b3c218ab0d2d2016c55d169a.tar.gz
unit-faf4ad54785fa418b3c218ab0d2d2016c55d169a.tar.bz2
Tests: increased subprocess timeout on Unit exit.
Also changed order of subprocess status checks. _terminate_process() method removed.
Diffstat (limited to 'test/unit/main.py')
-rw-r--r--test/unit/main.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/unit/main.py b/test/unit/main.py
index 873f1815..f5727726 100644
--- a/test/unit/main.py
+++ b/test/unit/main.py
@@ -240,24 +240,24 @@ class TestUnit(unittest.TestCase):
break
time.sleep(0.1)
- if os.path.exists(self.testdir + '/unit.pid'):
- exit("Could not terminate unit")
+ self._p.join(timeout=5)
- self._started = False
+ if self._p.is_alive():
+ self._p.terminate()
+ self._p.join(timeout=5)
- self._p.join(timeout=1)
- self._terminate_process(self._p)
+ if self._p.is_alive():
+ self.fail("Could not terminate process " + str(self._p.pid))
- def _terminate_process(self, process):
- if process.is_alive():
- process.terminate()
- process.join(timeout=5)
+ if os.path.exists(self.testdir + '/unit.pid'):
+ self.fail("Could not terminate unit")
- if process.is_alive():
- exit("Could not terminate process " + process.pid)
+ self._started = False
- if process.exitcode:
- exit("Child process terminated with code " + str(process.exitcode))
+ if self._p.exitcode:
+ self.fail(
+ "Child process terminated with code " + str(self._p.exitcode)
+ )
def _check_alerts(self, log):
found = False