Commit e777ed06 authored by Sebastien Robin's avatar Sebastien Robin Committed by Cédric Le Ninivin

testnode: try much more agressively to kill remaining processes (fixup)

Kill any process having in command line the path reserved for unit
test. This would really allows to kill any remaining process if any.

Do not look if processes are child of testnode, because processes
like mariadb and others are not running as child
parent 2d3e3642
......@@ -207,7 +207,7 @@ class SlapOSControler(object):
createFolder(self.software_root, True)
def initializeSlapOSControler(self, slapproxy_log=None, process_manager=None,
reset_software=False, software_path_list=None, process_path_to_kill=None):
reset_software=False, software_path_list=None):
self.process_manager = process_manager
self.software_path_list = software_path_list
logger.debug('SlapOSControler, initialize, reset_software: %r', reset_software)
......@@ -229,9 +229,6 @@ class SlapOSControler(object):
slapproxy_log_fp = open(slapproxy_log, 'w')
kwargs['stdout'] = slapproxy_log_fp
kwargs['stderr'] = slapproxy_log_fp
# Make sure there is no slapos alive from previous run
if process_path_to_kill is not None:
process_manager.killall(process_path_to_kill)
proxy = subprocess.Popen([config['slapos_binary'],
'proxy', 'start', '--cfg' , self.slapos_config], **kwargs)
process_manager.process_pid_set.add(proxy.pid)
......@@ -362,4 +359,4 @@ class SlapOSControler(object):
# codes, but depending on slapos versions, we have inconsistent status
if status_dict['status_code'] in (1,2):
status_dict['status_code'] = 0
return status_dict
return status_dict
\ No newline at end of file
......@@ -53,8 +53,7 @@ class UnitTestRunner(object):
self.testnode.config)
def _prepareSlapOS(self, working_directory, slapos_instance,
create_partition=1, software_path_list=None,
process_path_to_kill=None, **kw):
create_partition=1, software_path_list=None,**kw):
"""
Launch slapos to build software and partitions
"""
......@@ -73,7 +72,7 @@ class UnitTestRunner(object):
slapos_controler.initializeSlapOSControler(slapproxy_log=slapproxy_log,
process_manager=self.testnode.process_manager, reset_software=reset_software,
software_path_list=software_path_list, process_path_to_kill=process_path_to_kill)
software_path_list=software_path_list)
self.testnode.process_manager.supervisord_pid_file = os.path.join(\
slapos_controler.instance_root, 'var', 'run', 'supervisord.pid')
method_list= ["runSoftwareRelease"]
......@@ -119,8 +118,7 @@ class UnitTestRunner(object):
return self._prepareSlapOS(node_test_suite.working_directory,
node_test_suite,
software_path_list=[node_test_suite.custom_profile_path],
cluster_configuration={'_': json.dumps(node_test_suite.cluster_configuration)},
process_path_to_kill=node_test_suite.test_node_working_directory)
cluster_configuration={'_': json.dumps(node_test_suite.cluster_configuration)})
def getInstanceRoot(self, node_test_suite):
return self._getSlapOSControler(
......@@ -181,4 +179,4 @@ class UnitTestRunner(object):
Used by the method testnode.constructProfile() to know
if the software.cfg have to use relative path or not.
"""
return False
return False
\ No newline at end of file
......@@ -246,6 +246,7 @@ shared = true
def cleanUp(self):
logger.debug('Testnode.cleanUp')
self.process_manager.killPreviousRun()
self.process_manager.killall(self.working_directory)
self._cleanupLog()
self._cleanupTemporaryFiles()
......@@ -420,4 +421,4 @@ shared = true
# Exceptions are swallowed during cleanup phase
logger.info("GENERAL EXCEPTION, QUITING")
self.cleanUp()
logger.info("GENERAL EXCEPTION, QUITING, cleanup finished")
logger.info("GENERAL EXCEPTION, QUITING, cleanup finished")
\ No newline at end of file
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