mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Kill all child processes of the test master daemon after each test run.
This commit is contained in:
parent
ab7ace6aa5
commit
35ea9ed02d
1 changed files with 11 additions and 0 deletions
|
@ -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):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue