Merge "Fixing occasional fail of test_create_action_execution"

This commit is contained in:
Jenkins 2015-09-02 07:19:09 +00:00 committed by Gerrit Code Review
commit adc509f622
2 changed files with 8 additions and 6 deletions

View File

@ -1039,8 +1039,10 @@ class ActionExecutionTestsV2(base.TestCase):
# We must reread action execution in order to get actual
# state and output.
resp, body = self.client.get('action_executions/%s' % body['id'])
body = json.loads(body)
body = self.client.wait_execution_success(
body,
url='action_executions'
)
output = json.loads(body['output'])
self.assertEqual('SUCCESS', body['state'])

View File

@ -84,7 +84,7 @@ class MistralClientBase(rest_client.RestClient):
return resp, json.loads(body)
def wait_execution_success(self, ex_body, timeout=180):
def wait_execution_success(self, ex_body, timeout=180, url='executions'):
start_time = time.time()
expected_states = ['SUCCESS', 'RUNNING']
@ -95,16 +95,16 @@ class MistralClientBase(rest_client.RestClient):
"to SUCCESS. Execution: {1}".format(timeout, ex_body))
raise exceptions.TimeoutException(msg)
_, ex_body = self.get_object('executions', ex_body['id'])
_, ex_body = self.get_object(url, ex_body['id'])
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)
time.sleep(1)
return True
return ex_body
class MistralClientV2(MistralClientBase):