Kill all child processes of the test master daemon after each test run.

This commit is contained in:
Eivind Uggedal 2012-02-20 13:22:02 +01:00
parent ab7ace6aa5
commit 35ea9ed02d

View file

@ -1,5 +1,6 @@
import multiprocessing
import os
import signal
import salt
import salt.config
@ -49,9 +50,19 @@ class TestDaemon(object):
Kill the minion and master processes
'''
self.minion_process.terminate()
self.stop_master_processes()
self.master_process.terminate()
def stop_master_processes(self):
with open(self.master_opts['pidfile']) as pidfile:
for pid in pidfile.readlines():
if len(pid.strip()):
try:
os.kill(int(pid.strip()), signal.SIGTERM)
except OSError:
pass
class ModuleCase(TestCase):
'''