-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests and fix arguments with multiple values
- Loading branch information
1 parent
6b3c5b4
commit a4a04c9
Showing
4 changed files
with
146 additions
and
7 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
31 changes: 31 additions & 0 deletions
31
src/test/resources/testnextflowvdsl3/src/multiple_emit_channels/config.vsh.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,31 @@ | ||
name: multiple_emit_channels | ||
argument_groups: | ||
- name: Outputs | ||
arguments: | ||
- name: "--input" | ||
type: file | ||
description: Input file | ||
required: true | ||
example: input.txt | ||
- name: "--step_1_output" | ||
required: true | ||
type: file | ||
direction: output | ||
- name: "--step_3_output" | ||
required: true | ||
type: file | ||
direction: output | ||
- name: "--multiple_output" | ||
required: true | ||
multiple: true | ||
type: file | ||
direction: output | ||
resources: | ||
- type: nextflow_script | ||
path: main.nf | ||
entrypoint: base | ||
dependencies: | ||
- name: step1 | ||
- name: step3 | ||
platforms: | ||
- type: nextflow |
63 changes: 63 additions & 0 deletions
63
src/test/resources/testnextflowvdsl3/src/multiple_emit_channels/main.nf
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,63 @@ | ||
workflow base { | ||
take: input_ch | ||
main: | ||
|
||
step_1_ch = input_ch | ||
// test fromstate and tostate with list[string] | ||
| step1.run( | ||
fromState: ["input"], | ||
toState: { id, output, state -> ["step_1_output": output.output, "multiple_output": output.output] } | ||
) | ||
|
||
step_3_ch = input_ch | ||
// test fromstate and tostate with map[string, string] | ||
| step3.run( | ||
fromState: ["input"], | ||
toState: { id, output, state -> ["step_3_output": output.output, "multiple_output": output.output] } | ||
) | ||
|
||
emit: | ||
step_1_ch | ||
step_3_ch | ||
} | ||
|
||
workflow test_base { | ||
// todo: fix how `test_base` is able to access the test resources | ||
Channel.value([ | ||
"foo", | ||
[ | ||
"input": file("${params.rootDir}/resources/lines3.txt") | ||
] | ||
]) | ||
| multiple_emit_channels | ||
| toList() | ||
| view { output_list -> | ||
assert output_list.size() == 1 : "output channel should contain 1 event" | ||
|
||
def event = output_list[0] | ||
assert event.size() == 2 : "outputs should contain two elements; [id, state]" | ||
def id = event[0] | ||
|
||
// check id | ||
assert id == "foo" : "id should be foo" | ||
|
||
// check state | ||
def state = event[1] | ||
assert state instanceof Map : "state should be a map" | ||
assert "step_1_output" in state : "state should contain key 'step_1_output'" | ||
assert "step_3_output" in state : "state should contain key 'step_3_output'" | ||
|
||
def step_1_output = state.step_1_output | ||
assert step_1_output instanceof Path: "step_1_output should be a file" | ||
assert step_1_output.toFile().exists() : "step_1_output file should exist" | ||
|
||
def step_3_output = state.step_3_output | ||
assert step_3_output instanceof Path: "step_3_output should be a file" | ||
assert step_3_output.toFile().exists() : "step_3_output file should exist" | ||
|
||
assert "multiple_output" in state : "state should contain 'multiple_output'" | ||
def multiple_output = state.multiple_output | ||
assert multiple_output instanceof List: "multiple_output should be a list" | ||
assert multiple_output.size() == 2 | ||
} | ||
} |
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