Fix how "has_next_tasks" is calculated for task executions

* There was a weird typo in the list generator expression made in
  https://review.opendev.org/#/c/652575 that led to calculating
  a field value in the wrong way. Fixed. The added test was
  previously failing.

Closes-Bug: #1829841

Change-Id: I6b8ea8dfa623acbb56f649630ddee62e43d484eb
This commit is contained in:
Renat Akhmerov 2019-05-21 17:18:25 +07:00
parent 26b9cc2bac
commit a477fe49cd
3 changed files with 27 additions and 1 deletions

View File

@ -274,7 +274,7 @@ class Task(object):
cmds = wf_ctrl.continue_workflow(task_ex=self.task_ex)
# Check whether the task generated any next tasks.
if any([not commands.is_engine_command(c)] for c in cmds):
if any([not commands.is_engine_command(c) for c in cmds]):
self.task_ex.has_next_tasks = True
# Check whether the error is handled.

View File

@ -1133,3 +1133,22 @@ class DirectWorkflowEngineTest(base.EngineTestCase):
# converted into a string no matter what we tried to assign. But
# that didn't happen on Python 2.7 which caused an SQL exception.
self.assertIsInstance(task_ex.state_info, six.string_types)
def test_single_fail_with_next_noop(self):
wf_text = """---
version: '2.0'
wf:
tasks:
task1:
action: std.fail
on-error:
- noop
"""
wf_service.create_workflows(wf_text)
# Start workflow.
wf_ex = self.engine.start_workflow('wf')
self.await_workflow_success(wf_ex.id)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
There was a weird typo in the list generator expression made in
https://review.opendev.org/#/c/652575 that led to calculating
a field value in the wrong way. Fixed. The added test was
previously failing.