-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add tests for conditional activity skip
- Loading branch information
1 parent
8bd4139
commit c20c4be
Showing
5 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
tests/data/workflows/unit_conditional_adder_tree_continues.yml
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,45 @@ | ||
title: Adder tree continues | ||
# A | ||
# /\ | ||
# B C <- C should run | ||
description: Test that the condition returns true and C runs | ||
config: | ||
scheduler: dynamic | ||
entrypoint: a | ||
inputs: | ||
another_url: http://api:8000 | ||
value: 1 | ||
|
||
triggers: | ||
- type: webhook | ||
ref: my_webhook | ||
id: wh-XXXXXX | ||
entrypoint: a # This can be any | ||
args: | ||
url: http://api:8000/test/items/1 | ||
method: GET | ||
|
||
actions: | ||
- ref: a | ||
action: example.passthrough | ||
args: | ||
value: "1" | ||
|
||
- ref: b | ||
action: example.add | ||
args: | ||
# Demonstrate casting | ||
lhs: ${{ ACTIONS.a.result -> int }} | ||
rhs: 1 | ||
depends_on: | ||
- a | ||
|
||
- ref: c | ||
action: example.add | ||
args: | ||
lhs: 3 | ||
rhs: ${{ ACTIONS.a.result -> int }} | ||
depends_on: | ||
- a | ||
# This task should run, as a.result is "1" | ||
run_if: ${{ FNS.is_equal(ACTIONS.a.result, str(1)) }} |
14 changes: 14 additions & 0 deletions
14
tests/data/workflows/unit_conditional_adder_tree_continues_expected.yaml
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,14 @@ | ||
ACTIONS: | ||
a: | ||
result: "1" | ||
result_typename: "str" | ||
b: | ||
result: 2 | ||
result_typename: "int" | ||
c: | ||
result: 4 | ||
result_typename: "int" | ||
|
||
INPUTS: | ||
another_url: http://api:8000 | ||
value: 1 |
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,45 @@ | ||
title: Adder tree 1 Workflow | ||
# A | ||
# /\ | ||
# B [C] <- C should not run | ||
description: Test that the condition returns false and C does not run | ||
config: | ||
scheduler: dynamic | ||
entrypoint: a | ||
inputs: | ||
another_url: http://api:8000 | ||
value: 1 | ||
|
||
triggers: | ||
- type: webhook | ||
ref: my_webhook | ||
id: wh-XXXXXX | ||
entrypoint: a # This can be any | ||
args: | ||
url: http://api:8000/test/items/1 | ||
method: GET | ||
|
||
actions: | ||
- ref: a | ||
action: example.passthrough | ||
args: | ||
value: "1" | ||
|
||
- ref: b | ||
action: example.add | ||
args: | ||
# Demonstrate casting | ||
lhs: ${{ ACTIONS.a.result -> int }} | ||
rhs: 1 | ||
depends_on: | ||
- a | ||
|
||
- ref: c | ||
action: example.add | ||
args: | ||
lhs: 3 | ||
rhs: ${{ ACTIONS.a.result -> int }} | ||
depends_on: | ||
- a | ||
# This task should not run, as a.result is "1" | ||
run_if: ${{ FNS.is_equal(ACTIONS.a.result, str(2)) }} |
10 changes: 10 additions & 0 deletions
10
tests/data/workflows/unit_conditional_adder_tree_halt_expected.yaml
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,10 @@ | ||
ACTIONS: | ||
a: | ||
result: "1" | ||
result_typename: "str" | ||
b: | ||
result: 2 | ||
result_typename: "int" | ||
INPUTS: | ||
another_url: "http://api:8000" | ||
value: 1 |
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