Return the actual error message back to zuul

Change-Id: Ib615be2bfb16cd92914626c89fb72db0e3c6a382
This commit is contained in:
Joshua Hesketh 2013-12-17 11:47:55 +11:00
parent dce07dfd44
commit a581752a93
3 changed files with 7 additions and 4 deletions

View File

@ -64,7 +64,8 @@ class TestHandleResults(testtools.TestCase):
dataset_config)
self.assertFalse(result)
self.assertEqual(msg,
'Final schema version does not match expectation')
'FAILURE: Final schema version does not match '
'expectation')
handle_results.find_schemas = lambda x: [228]
result, msg = handle_results.check_log_for_errors(logfile, gitpath,

View File

@ -133,8 +133,8 @@ def check_log_for_errors(logfile, gitpath, dataset_config):
# Check the final version is as expected
final_version = MIGRATION_FINAL_SCHEMA_RE.findall(line)[0]
if int(final_version) != max(find_schemas(gitpath)):
return False, ("Final schema version does not match "
"expectation")
return False, ("FAILURE: Final schema version does not "
"match expectation")
if migration_started:
# We never saw the end of a migration,

View File

@ -124,6 +124,7 @@ class Runner(object):
def _check_all_dataset_logs_for_errors(self):
self.log.debug("Check logs for errors")
success = True
messages = []
for i, dataset in enumerate(self.job_datasets):
# Look for the beginning of the migration start
dataset_success, message = \
@ -131,12 +132,13 @@ class Runner(object):
dataset['job_log_file_path'], self.git_path,
dataset['config'])
self.job_datasets[i]['result'] = message
messages.append(message)
success = False if not dataset_success else success
if success:
self.work_data['result'] = "SUCCESS"
else:
self.work_data['result'] = "Failed: errors found in dataset log(s)"
self.work_data['result'] = "\n".join(messages)
def _get_datasets(self):
self.log.debug("Get configured datasets to run tests against")