Commit 408aec2b authored by Xavier Thompson's avatar Xavier Thompson

test_check_service_state: fix a data race

See merge request nexedi/slapos.toolbox!93
parent 6fb40ef9
...@@ -33,6 +33,7 @@ import tempfile ...@@ -33,6 +33,7 @@ import tempfile
import os import os
import unittest import unittest
import shutil import shutil
import psutil
import textwrap import textwrap
import subprocess import subprocess
...@@ -95,8 +96,12 @@ class TestCheckServiceState(TestPromisePluginMixin): ...@@ -95,8 +96,12 @@ class TestCheckServiceState(TestPromisePluginMixin):
def tearDown(self): def tearDown(self):
TestPromisePluginMixin.tearDown(self) TestPromisePluginMixin.tearDown(self)
with getSupervisorRPC(self._supervisor_socket) as supervisor: with getSupervisorRPC(self._supervisor_socket) as supervisor:
supervisor_process = psutil.Process(supervisor.getPID())
supervisor.stopAllProcesses() supervisor.stopAllProcesses()
supervisor.shutdown() supervisor.shutdown()
_, alive = psutil.wait_procs([supervisor_process], timeout=300)
if alive:
supervisor_process.kill()
shutil.rmtree(self._tempdir) shutil.rmtree(self._tempdir)
def test_running_expect_running(self): def test_running_expect_running(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment