Use id of workflow instead of name to keep track of what is created

With concurrent test executions it is possible that namespaced and
non-namespaced tests run at the same time, making it flaky whether
the name of the workflow is enough to identify the workflow. Using
the id should work in all cases.

Change-Id: Ib0e7d31f9a983c723704b64b1c46940aace545d7
This commit is contained in:
Andras Kovi 2018-07-18 13:16:53 +02:00
parent 1c0d05e45e
commit e6e8f61c2e
2 changed files with 7 additions and 5 deletions

View File

@ -69,7 +69,7 @@ class MistralClientV2(base.MistralClientBase):
for wf in wfs['workflows']:
if wf['name'].startswith(wb_name):
self.workflows.append(wf['name'])
self.workflows.append(wf['id'])
return resp, json.loads(body)
@ -85,8 +85,7 @@ class MistralClientV2(base.MistralClientBase):
resp, body = self.post_request(url_path, yaml_file)
for wf in json.loads(body)['workflows']:
identifier = wf['id'] if namespace else wf['name']
self.workflows.append(identifier)
self.workflows.append(wf['id'])
return resp, json.loads(body)

View File

@ -27,7 +27,11 @@ class WorkflowTestsV2(base.TestCase):
def tearDown(self):
for wf in self.client.workflows:
self.client.delete_obj('workflows', wf)
try:
self.client.delete_obj('workflows', wf)
except exceptions.NotFound:
pass
self.client.workflows = []
super(WorkflowTestsV2, self).tearDown()
@ -211,7 +215,6 @@ class WorkflowTestsV2(base.TestCase):
self.assertIn(name, names)
self.client.delete_obj('workflows', name)
self.client.workflows.remove(name)
_, body = self.client.get_list_obj('workflows')