diff --git a/erp5/tests/testERP5TestNode.py b/erp5/tests/testERP5TestNode.py index 6588683495ec940991f8a4860170acc6821f0e0a..af58699b4ef8b9966ea4ce0efcbb5a855e4f11d4 100644 --- a/erp5/tests/testERP5TestNode.py +++ b/erp5/tests/testERP5TestNode.py @@ -459,11 +459,13 @@ branch = foo self.assertRaises(SubprocessError, runner.prepareSlapOSForTestSuite, node_test_suite) - def test_11_run(self, my_test_type='UnitTest'): + def test_11_run(self, my_test_type='UnitTest', grade='master'): def doNothing(self, *args, **kw): pass - def patch_getTestType(self): + def patch_getTestType(self, *args, **kw): return my_test_type + def patch_isValidatedMaster(self, *args, **kw): + return (grade == 'master') test_self = self test_result_path_root = os.path.join(test_self._temp_dir,'test/results') os.makedirs(test_result_path_root) @@ -472,12 +474,17 @@ branch = foo def patch_startTestSuite(self,test_node_title): global counter config_list = [] + # Sclalability slave testnode is not directly in charge of testsuites + if my_test_type == 'ScalabilityTest' and grade == 'slave': + count += 5 + return [] + def _checkExistingTestSuite(reference_set): test_self.assertEquals(set(reference_set), - set(os.listdir(test_node.working_directory))) + set(os.listdir(test_node.working_directory))) for x in reference_set: test_self.assertTrue(os.path.exists(os.path.join( - test_node.working_directory,x)),True) + test_node.working_directory,x)),True) if counter == 0: config_list.append(test_self.getTestSuiteData(reference='foo')[0]) config_list.append(test_self.getTestSuiteData(reference='bar')[0]) @@ -516,12 +523,16 @@ branch = foo self.generateTestRepositoryList() RunnerClass = self.returnGoodClassRunner(my_test_type) # Patch + if my_test_type == 'ScalabilityTest': + original_isValidatedMaster = TaskDistributor.isValidatedMaster + TaskDistributor.isValidatedMaster = patch_isValidatedMaster original_startTestSuite = TaskDistributor.startTestSuite original_subscribeNode = TaskDistributor.subscribeNode original_getTestType = TaskDistributor.getTestType TaskDistributor.startTestSuite = patch_startTestSuite TaskDistributor.subscribeNode = doNothing TaskDistributor.getTestType = patch_getTestType + original_createTestResult = TaskDistributionTool.createTestResult TaskDistributionTool.createTestResult = patch_createTestResult # TestNode @@ -537,6 +548,8 @@ branch = foo self.assertEquals(5, counter) time.sleep = original_sleep # Restore old class methods + if my_test_type == 'ScalabilityTest': + TaskDistributor.isValidatedMaster = original_isValidatedMaster TaskDistributor.startTestSuite = original_startTestSuite TaskDistributionTool.createTestResult = original_createTestResult TaskDistributionTool.subscribeNode = original_subscribeNode @@ -584,7 +597,7 @@ branch = foo def test_15_suite_log_directory(self, my_test_type='UnitTest'): def doNothing(self, *args, **kw): pass - def patch_getTestType(self): + def patch_getTestType(self, *args, **kw): return my_test_type test_self = self test_result_path_root = os.path.join(test_self._temp_dir,'test/results') @@ -767,8 +780,10 @@ branch = foo # This case test may be dispensable on ScalabilityTest case # so.. pass - def test_scalability_11_run(self, my_test_type='ScalabilityTest'): - self.test_11_run(my_test_type) + def test_scalability_as_master_11_run(self, my_test_type='ScalabilityTest'): + self.test_11_run(my_test_type, grade='master') + def test_scalability_as_slave_11_run(self, my_test_type='ScalabilityTest'): + self.test_11_run(my_test_type, grade='slave') def test_scalability_12_spawn(self, my_test_type='ScalabilityTest'): self.test_12_spawn(my_test_type) def test_scalability_13_SlaposControlerResetSoftware(self, my_test_type='ScalabilityTest'): diff --git a/erp5/util/testnode/ScalabilityTestRunner.py b/erp5/util/testnode/ScalabilityTestRunner.py index 5968e27f88df9266bc229bb883f987e80079cc81..20e4b886bdac9c6032e8601488689dfa5c64f5a8 100644 --- a/erp5/util/testnode/ScalabilityTestRunner.py +++ b/erp5/util/testnode/ScalabilityTestRunner.py @@ -79,11 +79,11 @@ class ScalabilityTestRunner(): We will build slapos software needed by the testnode itself, """ if self.test_suite_portal.isValidatedMaster(self.config['test_node_title']): - software_path_list = [] - software_path_list.append(self.testnode.config.get("software_list")) - for software_path in software_path_list: - for launcher_node in self.launcher_nodes: - self._prepareSlapOS(software_path, launcher_node['computer_id']) +# software_path_list = [] +# software_path_list.append(self.testnode.config.get("software_list")) +# for software_path in software_path_list: +# for launcher_node in self.????_nodes: +# self._prepareSlapOS(software_path, launcher_node['computer_id']) # TODO : change the line below return {'status_code' : 0} else: