Add a test that verifies an old bug with join

* There was a bug in stable/libery that occurred in case when we
  had a "join" task that joined multiple branches sourced from
  the same task. In this case line 302 (in the current revision)
  in direct_workflow.py caused IndexError when evaluating in_t_ex[-1]
  as described in the bug. This bug was implicitly fixed since then
  but a test for it was missing. This patch adds a test to prevent
  this bug occurrence in the future.

Change-Id: If277989cc9149b219a9c63287290daa321a3e438
Closes-Bug: #1539173
This commit is contained in:
Renat Akhmerov 2016-06-08 11:42:38 +07:00
parent f6fd4da1d7
commit 70adb4512f

View File

@ -624,28 +624,22 @@ class JoinEngineTest(base.EngineTestCase):
version: '2.0'
test-join:
type: direct
tasks:
a:
action: std.noop
on-success:
- b
- c
- d
b:
action: std.noop
on-success:
- e
c:
action: std.noop
on-success:
- e
d:
action: std.noop
on-success:
- e
@ -664,3 +658,34 @@ class JoinEngineTest(base.EngineTestCase):
tasks = wf_ex.task_executions
self._assert_multiple_items(tasks, 5, state=states.SUCCESS)
def test_join_multiple_routes_with_one_source(self):
wf_text = """---
version: '2.0'
wf:
tasks:
a:
on-success:
- b
- c
b:
on-success:
- c
c:
join: all
"""
wf_service.create_workflows(wf_text)
wf_ex = self.engine.start_workflow('wf', {})
self.await_execution_success(wf_ex.id)
wf_ex = db_api.get_workflow_execution(wf_ex.id)
tasks = wf_ex.task_executions
self._assert_multiple_items(tasks, 3, state=states.SUCCESS)