Fix an expression context for all_errors_handled()
* "__task_execution" wasn't included in this case into the expression data context so the function task() didn't work properly Change-Id: I3cacae90f9031d09a5e6d8153d728ddc01e1bb21 Closes-Bug: #1823875
This commit is contained in:
parent
eba2314bb3
commit
b0829f943b
@ -293,6 +293,34 @@ class YAQLFunctionsEngineTest(engine_test_base.EngineTestCase):
|
||||
self._assert_single_item(wf_ex.task_executions, name='task1')
|
||||
self._assert_single_item(wf_ex.task_executions, name='task2')
|
||||
|
||||
def test_task_function_no_name_when_calculating_end_tasks(self):
|
||||
wf_text = """---
|
||||
version: '2.0'
|
||||
|
||||
wf:
|
||||
tasks:
|
||||
task1:
|
||||
action: std.fail error_data="Some data"
|
||||
on-error:
|
||||
- task2: <% task().result != '' %>
|
||||
|
||||
task2:
|
||||
action: std.echo output=2
|
||||
"""
|
||||
|
||||
wf_service.create_workflows(wf_text)
|
||||
|
||||
wf_ex = self.engine.start_workflow('wf')
|
||||
|
||||
self.await_workflow_success(wf_ex.id)
|
||||
|
||||
with db_api.transaction():
|
||||
wf_ex = db_api.get_workflow_execution(wf_ex.id)
|
||||
|
||||
self.assertEqual(2, len(wf_ex.task_executions))
|
||||
self._assert_single_item(wf_ex.task_executions, name='task1')
|
||||
self._assert_single_item(wf_ex.task_executions, name='task2')
|
||||
|
||||
def test_uuid_function(self):
|
||||
wf_text = """---
|
||||
version: '2.0'
|
||||
|
@ -198,6 +198,7 @@ class DirectWorkflowController(base.WorkflowController):
|
||||
def all_errors_handled(self):
|
||||
for t_ex in lookup_utils.find_error_task_executions(self.wf_ex.id):
|
||||
ctx_view = data_flow.ContextView(
|
||||
data_flow.get_current_task_dict(t_ex),
|
||||
data_flow.evaluate_task_outbound_context(t_ex),
|
||||
data_flow.get_workflow_environment_dict(self.wf_ex),
|
||||
self.wf_ex.context,
|
||||
@ -230,9 +231,7 @@ class DirectWorkflowController(base.WorkflowController):
|
||||
)
|
||||
|
||||
for batch in batches:
|
||||
yield list(
|
||||
filter(is_end_task, batch)
|
||||
)
|
||||
yield list(filter(is_end_task, batch))
|
||||
|
||||
def may_complete_workflow(self, task_ex):
|
||||
res = super(DirectWorkflowController, self).may_complete_workflow(
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
"__task_execution" wasn't always included into the expression data
|
||||
context so the function task() didn't work properly.
|
||||
Fixes [`bug 1823875 <https://bugs.launchpad.net/mistral/+bug/1823875>`_]
|
Loading…
Reference in New Issue
Block a user