Allow filtering executions by their root_execution_id

With this filter, it will be possible to find all the workflow
executions started by a root execution.

Implements: blueprint mistral-root-execution-id
Change-Id: Ie18493c8f59f5d77107f0adf5db491b0db05cee2
(cherry picked from commit 28130bb862b33c57f5513fbe139eee3e4444fdac)
This commit is contained in:
Dougal Matthews 2017-08-03 16:13:53 +01:00
parent 59b2013c6b
commit 7963809930
3 changed files with 46 additions and 2 deletions

View File

@ -232,13 +232,14 @@ class ActionExecutionTestsV2(base.TestCase):
def test_action_execution_of_workflow_within_namespace(self):
resp, body = self.client.create_workflow('wf_v2.yaml', namespace='abc')
wf_name = body['workflows'][0]['name']
wf_name = "wf"
wf_namespace = body['workflows'][0]['namespace']
self.assertEqual(201, resp.status)
resp, body = self.client.create_execution(
resp, execution = self.client.create_execution(
wf_name,
wf_namespace=wf_namespace
)
self.client.wait_execution_success(execution)
self.assertEqual(201, resp.status)
resp, body = self.client.get_list_obj('tasks')
self.assertEqual(200, resp.status)

View File

@ -33,6 +33,7 @@ class ExecutionTestsV2(base.TestCase):
self.direct_wf_name = 'wf'
self.direct_wf2_name = 'wf2'
self.sub_wf_name = 'subwf1'
self.direct_wf_id = body['workflows'][0]['id']
reverse_wfs = [wf for wf in body['workflows'] if wf['name'] == 'wf1']
self.reverse_wf = reverse_wfs[0]
@ -416,3 +417,24 @@ class ExecutionTestsV2(base.TestCase):
self.assertEqual('lowest_level_wf', action_execution['workflow_name'])
self.assertEqual(namespace, action_execution['workflow_namespace'])
@decorators.attr(type='sanity')
@decorators.idempotent_id('2baa25c5-0b65-4fbe-8d90-2c6599831b6b')
def test_root_execution_id(self):
resp, execution = self.client.create_execution(self.sub_wf_name)
self.assertEqual(201, resp.status)
self.assertEqual('RUNNING', execution['state'])
self.client.wait_execution_success(execution)
resp, body = self.client.get_list_obj(
'executions?root_execution_id={}'.format(execution['id']))
self.assertEqual(200, resp.status)
self.assertNotEmpty(body['executions'])
self.assertEqual(2, len(body['executions']))
for exc in body['executions']:
self.assertEqual(exc['root_execution_id'], execution['id'])

View File

@ -32,3 +32,24 @@ wf2:
tasks:
hello:
action: std.echo output="Doe"
subwf1:
type: direct
tasks:
task1:
workflow: subwf2
subwf2:
type: direct
tasks:
task1:
workflow: subwf3
subwf3:
type: direct
tasks:
task1:
action: std.noop