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()),)) ...@@ -384,7 +384,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
node_test_suite.project_title) node_test_suite.project_title)
count = 0 count = 0
error = None error_message = None
# Each cluster configuration are tested # Each cluster configuration are tested
for configuration in configuration_list: for configuration in configuration_list:
...@@ -419,7 +419,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -419,7 +419,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# #
if test_result_line_proxy == None : if test_result_line_proxy == None :
error_message = "Test case already tested." error_message = "Test case already tested."
error = ValueError(error_message)
break break
self.log("Test for count : %d is in a running state." %count) 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()),)) ...@@ -435,7 +434,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
if test_result_line_proxy.isTestCaseAlive(): if test_result_line_proxy.isTestCaseAlive():
error_message = "Test case during for %s seconds, too long. (max: %s seconds). Test failure." \ 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) %(str(time.time() - test_case_start_time), MAX_TEST_CASE_TIME)
error = ValueError(error_message)
test_result_proxy.reportFailure(stdout=error_message) test_result_proxy.reportFailure(stdout=error_message)
break break
...@@ -446,7 +444,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -446,7 +444,6 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
break break
# Cancelled or in an undeterminate state. # Cancelled or in an undeterminate state.
error_message = "Test cancelled or undeterminate state." error_message = "Test cancelled or undeterminate state."
error = ValueError(error_message)
break break
# Stop current instance # Stop current instance
...@@ -457,9 +454,10 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),)) ...@@ -457,9 +454,10 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
self._cleanUpOldInstance() self._cleanUpOldInstance()
# If error appears then that's a test failure. # If error appears then that's a test failure.
if error: if error_message:
test_result_proxy.fail() test_result_proxy.fail()
raise error self.log("Test Failed.")
return {'status_code' : 1, 'error_message': error_message}
# Test is finished. # Test is finished.
self.log("Test finished.") self.log("Test finished.")
return {'status_code' : 0} return {'status_code' : 0}
......
...@@ -390,17 +390,30 @@ from the distributor.") ...@@ -390,17 +390,30 @@ from the distributor.")
# Give some time so computer partitions may start # Give some time so computer partitions may start
# as partitions can be of any kind we have and likely will never have # 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 ... # a reliable way to check if they are up or not ...
#time.sleep(20) time.sleep(20)
if my_test_type == 'UnitTest': if my_test_type == 'UnitTest':
runner.runTestSuite(node_test_suite, portal_url) runner.runTestSuite(node_test_suite, portal_url)
else: elif my_test_type == 'ScalabilityTest':
if status_dict['status_code'] == 0: error_message = None
runner.runTestSuite(node_test_suite, portal_url) # 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: 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( test_result.reportFailure(
command="runner.prepareSlapOSForTestSuite()", stdout=error_message
stdout="Software installation too long or error(s) are present."
) )
self.log(error_message)
raise ValueError(error_message)
else:
raise NotImplementedError
# break the loop to get latest priorities from master # break the loop to get latest priorities from master
break break
self.cleanUp(test_result) 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