Commit f8337edd authored by Benjamin Blanc's avatar Benjamin Blanc

Update

parent 8456c7c8
...@@ -503,9 +503,14 @@ branch = foo ...@@ -503,9 +503,14 @@ branch = foo
original_createTestResult = TaskDistributionTool.createTestResult original_createTestResult = TaskDistributionTool.createTestResult
TaskDistributionTool.createTestResult = patch_createTestResult TaskDistributionTool.createTestResult = patch_createTestResult
test_node = self.getTestNode() test_node = self.getTestNode()
runner = UnitTestRunner(test_node) runner = UnitTestRunner(test_node)
original_prepareSlapOS = runner._prepareSlapOS original_prepareSlapOS = runner._prepareSlapOS
runner._prepareSlapOS = doNothing runner._prepareSlapOS = doNothing
original_runTestSuite = runner.runTestSuite original_runTestSuite = runner.runTestSuite
runner.runTestSuite = doNothing runner.runTestSuite = doNothing
SlapOSControler.initializeSlapOSControler = doNothing SlapOSControler.initializeSlapOSControler = doNothing
......
...@@ -58,29 +58,8 @@ def createFile(path, mode, content): ...@@ -58,29 +58,8 @@ def createFile(path, mode, content):
class GenericSlapOSControler(object): # TODO : merge two controler in one (with different method name ?)
class SlapOSControlerCluster(object):
def __init__(self, working_directory, config, log):
self.config = config
self.software_root = os.path.join(working_directory, 'soft')
self.instance_root = os.path.join(working_directory, 'inst')
self.slapos_config = os.path.join(working_directory, 'slapos.cfg')
self.log = log
def _resetSoftware(self):
pass
def initializeSlapOSControler(self):
pass
def runSoftwareRelease(self):
pass
def runComputerPartition(self):
pass
class SlapOSControlerCluster(GenericSlapOSControler):
def __init__(self, working_directory, config, def __init__(self, working_directory, config,
log, configuration_path_file): log, configuration_path_file):
...@@ -91,7 +70,7 @@ class SlapOSControlerCluster(GenericSlapOSControler): ...@@ -91,7 +70,7 @@ class SlapOSControlerCluster(GenericSlapOSControler):
""" """
Supply several softwares from a list on a node Supply several softwares from a list on a node
Ex : Ex :
slapos_controler.initializeSlapOSControler(['kvm.cfg', 'ok.cfg'], 'COMP-726') my_controler.initializeSlapOSControler(['kvm.cfg', 'ok.cfg'], 'COMP-726')
""" """
for software_path in software_path_list: for software_path in software_path_list:
self._supply(software_path, computer_guid) self._supply(software_path, computer_guid)
...@@ -99,7 +78,7 @@ class SlapOSControlerCluster(GenericSlapOSControler): ...@@ -99,7 +78,7 @@ class SlapOSControlerCluster(GenericSlapOSControler):
def _supply(self, software_url, computer_id): def _supply(self, software_url, computer_id):
""" """
Ex : Ex :
slapos_controler._supply('kvm.cfg', 'COMP-726') my_controler._supply('kvm.cfg', 'COMP-726')
""" """
# TODO : remove return # TODO : remove return
return return
...@@ -126,7 +105,7 @@ class SlapOSControlerCluster(GenericSlapOSControler): ...@@ -126,7 +105,7 @@ class SlapOSControlerCluster(GenericSlapOSControler):
software_configuration : dict { "_" : "{'toto' : 'titi'}" } software_configuration : dict { "_" : "{'toto' : 'titi'}" }
Ex : Ex :
slapos_controler._request('Instance16h34Ben', my_controler._request('Instance16h34Ben',
'kvm.cfg', 'cluster', { "_" : "{'toto' : 'titi'}" } ) 'kvm.cfg', 'cluster', { "_" : "{'toto' : 'titi'}" } )
""" """
...@@ -154,10 +133,14 @@ class SlapOSControlerCluster(GenericSlapOSControler): ...@@ -154,10 +133,14 @@ class SlapOSControlerCluster(GenericSlapOSControler):
class SlapOSControler(GenericSlapOSControler): class SlapOSControler(object):
def __init__(self, working_directory, config, log): def __init__(self, working_directory, config, log):
GenericSlapOSControler.__init__(self, working_directory, config, log) self.config = config
self.software_root = os.path.join(working_directory, 'soft')
self.instance_root = os.path.join(working_directory, 'inst')
self.slapos_config = os.path.join(working_directory, 'slapos.cfg')
self.log = log
self.proxy_database = os.path.join(working_directory, 'proxy.db') self.proxy_database = os.path.join(working_directory, 'proxy.db')
def _resetSoftware(self): def _resetSoftware(self):
......
...@@ -74,9 +74,12 @@ class UnitTestRunner(): ...@@ -74,9 +74,12 @@ class UnitTestRunner():
method_list.append("runComputerPartition") method_list.append("runComputerPartition")
for method_name in method_list: for method_name in method_list:
slapos_method = getattr(self.slapos_controler, method_name) slapos_method = getattr(self.slapos_controler, method_name)
log("Before status_dict = slapos_method(...)")
status_dict = slapos_method(self.testnode.config, status_dict = slapos_method(self.testnode.config,
environment=self.testnode.config['environment'], environment=self.testnode.config['environment'],
) )
log(status_dict)
log("After status_dict = slapos_method(...)")
if status_dict['status_code'] != 0: if status_dict['status_code'] != 0:
slapos_instance.retry = True slapos_instance.retry = True
slapos_instance.retry_software_count += 1 slapos_instance.retry_software_count += 1
......
...@@ -395,6 +395,7 @@ class TestNode(BaseTestNode): ...@@ -395,6 +395,7 @@ class TestNode(BaseTestNode):
self.cleanUp(None) self.cleanUp(None)
remote_test_result_needs_cleanup = False remote_test_result_needs_cleanup = False
begin = time.time() begin = time.time()
portal_url = config['test_suite_master_url'] portal_url = config['test_suite_master_url']
portal = taskdistribution.TaskDistributionTool(portal_url, logger=DummyLogger(log)) portal = taskdistribution.TaskDistributionTool(portal_url, logger=DummyLogger(log))
test_suite_portal = taskdistribution.TaskDistributor(portal_url, logger=DummyLogger(log)) test_suite_portal = taskdistribution.TaskDistributor(portal_url, logger=DummyLogger(log))
...@@ -403,26 +404,32 @@ class TestNode(BaseTestNode): ...@@ -403,26 +404,32 @@ class TestNode(BaseTestNode):
log("Got following test suite data from master : %r" % \ log("Got following test suite data from master : %r" % \
(test_suite_data,)) (test_suite_data,))
##/BLOCK OK ##/BLOCK OK
# Here we know what we are (sclability or unit test) # Here we know what we are (sclability or unit test)
# self.prepareSlapOSForTestNode(test_node_slapos) # self.prepareSlapOSForTestNode(test_node_slapos)
# Select the good runner # Select the good runner
if True : if True :
runner = UnitTestRunner(self) runner = UnitTestRunner(self)
elif False : elif False :
runner = ScalabilityTestRunner(self) runner = ScalabilityTestRunner(self)
else : else :
runner = UnitTestRunner(self) runner = UnitTestRunner(self)
log("OKAYBEN1")
runner.prepareSlapOSForTestNode(test_node_slapos) runner.prepareSlapOSForTestNode(test_node_slapos)
log("OKAYBEN2")
#Clean-up test suites #Clean-up test suites
self.checkOldTestSuite(test_suite_data) self.checkOldTestSuite(test_suite_data)
for test_suite in test_suite_data: for test_suite in test_suite_data:
log("OKAYBEN3")
## BLOCK OK ## BLOCK OK
remote_test_result_needs_cleanup = False remote_test_result_needs_cleanup = False
node_test_suite = self.getNodeTestSuite( node_test_suite = self.getNodeTestSuite(
...@@ -503,7 +510,7 @@ class TestNode(BaseTestNode): ...@@ -503,7 +510,7 @@ class TestNode(BaseTestNode):
finally: finally:
# Nice way to kill *everything* generated by run process -- process # Nice way to kill *everything* generated by run process -- process
# groups working only in POSIX compilant systems # groups working only in POSIX compilant systems
# Exceptions are swallowed during cleanup phas # Exceptions are swallowed during cleanup phase
log("GENERAL EXCEPTION, QUITING") log("GENERAL EXCEPTION, QUITING")
self.cleanUp(test_result) self.cleanUp(test_result)
log("GENERAL EXCEPTION, QUITING, cleanup finished") log("GENERAL EXCEPTION, QUITING, cleanup finished")
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