Merge "Fix execution state ERROR if task_spec has on-finish"

This commit is contained in:
Jenkins 2014-09-03 07:50:41 +00:00 committed by Gerrit Code Review
commit ae66fc9468
2 changed files with 10 additions and 1 deletions

View File

@ -122,7 +122,8 @@ def is_success(tasks):
def is_error(tasks):
return any(task['state'] == states.ERROR and
not task['task_spec'].get('on-error', {}) for task in tasks)
not task['task_spec'].get('on-error', {}) and
not task['task_spec'].get('on-finish', {}) for task in tasks)
def _get_dependency_tasks(tasks_spec, task_spec):

View File

@ -143,6 +143,8 @@ class MistralClient(rest_client.RestClient):
start_time = time.time()
expected_states = ['SUCCESS', 'RUNNING']
while ex_body['state'] != 'SUCCESS':
if time.time() - start_time > timeout:
msg = "Execution exceeds timeout {0} to change state " \
@ -151,6 +153,12 @@ class MistralClient(rest_client.RestClient):
_, ex_body = self.get_execution(workbook_name, ex_body['id'])
ex_body = json.loads(ex_body)
if ex_body['state'] not in expected_states:
msg = "Execution state %s is not in expected " \
"states: %s" % (ex_body['state'], expected_states)
raise exceptions.TempestException(msg)
time.sleep(2)
return resp, ex_body