Commit ee12673f authored by Benjamin Blanc's avatar Benjamin Blanc

testnode: Fail test when error during SR install/runing test

parent a31d90bb
......@@ -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}
......
......@@ -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)
......
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