From ee12673ffa1a91bb88ec6cedaf1970151dbc1739 Mon Sep 17 00:00:00 2001 From: Benjamin Blanc <benjamin.blanc@tiolive.com> Date: Tue, 10 Sep 2013 10:50:49 +0200 Subject: [PATCH] testnode: Fail test when error during SR install/runing test --- erp5/util/testnode/ScalabilityTestRunner.py | 10 ++++----- erp5/util/testnode/testnode.py | 25 ++++++++++++++++----- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/erp5/util/testnode/ScalabilityTestRunner.py b/erp5/util/testnode/ScalabilityTestRunner.py index ad8e441ef8..32dec05895 100644 --- a/erp5/util/testnode/ScalabilityTestRunner.py +++ b/erp5/util/testnode/ScalabilityTestRunner.py @@ -384,7 +384,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) node_test_suite.project_title) count = 0 - error = None + error_message = None # Each cluster configuration are tested for configuration in configuration_list: @@ -419,7 +419,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) # if test_result_line_proxy == None : error_message = "Test case already tested." - error = ValueError(error_message) break self.log("Test for count : %d is in a running state." %count) @@ -435,7 +434,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) if test_result_line_proxy.isTestCaseAlive(): error_message = "Test case during for %s seconds, too long. (max: %s seconds). Test failure." \ %(str(time.time() - test_case_start_time), MAX_TEST_CASE_TIME) - error = ValueError(error_message) test_result_proxy.reportFailure(stdout=error_message) break @@ -446,7 +444,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) break # Cancelled or in an undeterminate state. error_message = "Test cancelled or undeterminate state." - error = ValueError(error_message) break # Stop current instance @@ -457,9 +454,10 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) self._cleanUpOldInstance() # If error appears then that's a test failure. - if error: + if error_message: test_result_proxy.fail() - raise error + self.log("Test Failed.") + return {'status_code' : 1, 'error_message': error_message} # Test is finished. self.log("Test finished.") return {'status_code' : 0} diff --git a/erp5/util/testnode/testnode.py b/erp5/util/testnode/testnode.py index d26a84df60..b91e505ff0 100644 --- a/erp5/util/testnode/testnode.py +++ b/erp5/util/testnode/testnode.py @@ -390,17 +390,30 @@ from the distributor.") # Give some time so computer partitions may start # as partitions can be of any kind we have and likely will never have # a reliable way to check if they are up or not ... - #time.sleep(20) + time.sleep(20) if my_test_type == 'UnitTest': runner.runTestSuite(node_test_suite, portal_url) - else: - if status_dict['status_code'] == 0: - runner.runTestSuite(node_test_suite, portal_url) + elif my_test_type == 'ScalabilityTest': + error_message = None + # A problem is appeared during runTestSuite + if status_dict['status_code'] == 1: + error_message = "Software installation too long or error(s) are present during SR install." else: + status_dict = runner.runTestSuite(node_test_suite, portal_url) + # A problem is appeared during runTestSuite + if status_dict['status_code'] == 1: + error_message = status_dict['error_message'] + + # If an error is appeared + if error_message: test_result.reportFailure( - command="runner.prepareSlapOSForTestSuite()", - stdout="Software installation too long or error(s) are present." + stdout=error_message ) + self.log(error_message) + raise ValueError(error_message) + else: + raise NotImplementedError + # break the loop to get latest priorities from master break self.cleanUp(test_result) -- 2.30.9