-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18ff3c7
commit 08cbb44
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from zrb.task.task import Task | ||
from zrb.task.cmd_task import CmdTask | ||
|
||
|
||
def test_task_execution_id_cannot_be_set_twice(): | ||
task = Task( | ||
name='task', | ||
run=lambda *args, **kwargs: kwargs.get('_task').get_execution_id() | ||
) | ||
task._set_execution_id('execution_id_1') | ||
task._set_execution_id('execution_id_2') | ||
task._set_execution_id('execution_id_3') | ||
function = task.to_function() | ||
result = function() | ||
assert result == 'execution_id_1' | ||
|
||
|
||
def test_consistent_task_upstream_execution_id(): | ||
task_upstream_1 = Task( | ||
name='task-upstream-1', | ||
run=lambda *args, **kwargs: kwargs.get('_task').get_execution_id() | ||
) | ||
task_upstream_2 = CmdTask( | ||
name='task-upstream-2', | ||
cmd='echo $_ZRB_EXECUTION_ID' | ||
) | ||
task = Task( | ||
name='task', | ||
upstreams=[ | ||
task_upstream_1, task_upstream_2 | ||
], | ||
return_upstream_result=True | ||
) | ||
function = task.to_function() | ||
result = function() | ||
assert result[0] == result[1].output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters