-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for workflow.onComplete and workflow.onError de…
…fined in workflow script fix unit tests and workflow_oncomplete test Signed-off-by: jorgee <[email protected]>
- Loading branch information
Showing
6 changed files
with
133 additions
and
5 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
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
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,21 @@ | ||
set -e | ||
|
||
# | ||
# run normal mode | ||
# | ||
echo '' | ||
$NXF_RUN | tee stdout | ||
|
||
[[ `grep -c 'Workflow Executed!' stdout` == 1 ]] || false | ||
[[ `grep -c 'local variable: local' stdout` == 1 ]] || false | ||
[[ `grep -c 'param output dir: results' stdout` == 1 ]] || false | ||
[[ `grep -c 'Method executed!' stdout` == 1 ]] || false | ||
[[ `grep -c 'script-vars-oncomplete.nf' stdout` == 1 ]] || false | ||
[[ `grep -c "Can't access to a global variable" stdout` == 1 ]] || false | ||
[[ `grep -c "Can't access to a private workflow property" stdout` == 1 ]] || false | ||
[[ `grep -c 'Success!' stdout` == 1 ]] || false | ||
|
||
|
||
|
||
|
||
|
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,21 @@ | ||
set -e | ||
|
||
# | ||
# run normal mode | ||
# | ||
echo '' | ||
$NXF_RUN | tee stdout | ||
|
||
[[ `grep -c 'Workflow Failed!' stdout` == 1 ]] || false | ||
[[ `grep -c 'local variable: local' stdout` == 1 ]] || false | ||
[[ `grep -c 'param output dir: results' stdout` == 1 ]] || false | ||
[[ `grep -c 'Method executed!' stdout` == 1 ]] || false | ||
[[ `grep 'Executed script' stdout | grep -c 'script-vars-onerror.nf'` == 1 ]] || false | ||
[[ `grep -c "Can't access to a global variable" stdout` == 1 ]] || false | ||
[[ `grep -c "Can't access to a private workflow property" stdout` == 1 ]] || false | ||
[[ `grep -c 'Failure!' stdout` == 1 ]] || false | ||
|
||
|
||
|
||
|
||
|
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,35 @@ | ||
def global_var = 'global' | ||
|
||
def method() { | ||
println("Method executed!") | ||
} | ||
|
||
workflow { | ||
params.outdir = 'results' | ||
|
||
def local = 'local' | ||
|
||
workflow.onComplete { | ||
println("local variable: ${local}") | ||
println("param output dir: ${params.outdir}") | ||
method() | ||
println("Executed script : ${workflow.scriptFile}") | ||
// expected failure | ||
try { | ||
println("global variable: ${global}") | ||
}catch (groovy.lang.MissingPropertyException e){ | ||
println("Can't access to a global variable") | ||
} | ||
try { | ||
println("workflow private variable: ${events}") | ||
}catch (Exception e){ | ||
println("Can't access to a private workflow property") | ||
} | ||
if( workflow.success ) | ||
println("Success!") | ||
else | ||
println("Failure!") | ||
} | ||
|
||
println("Workflow Executed!") | ||
} |
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,35 @@ | ||
def global_var = 'global' | ||
|
||
def method() { | ||
println("Method executed!") | ||
} | ||
|
||
workflow { | ||
params.outdir = 'results' | ||
|
||
def local = 'local' | ||
|
||
workflow.onError { | ||
println("local variable: ${local}") | ||
println("param output dir: ${params.outdir}") | ||
method() | ||
println("Executed script : ${workflow.scriptFile}") | ||
// expected failures | ||
try { | ||
println("global variable: ${global}") | ||
}catch (groovy.lang.MissingPropertyException e){ | ||
println("Can't access to a global variable") | ||
} | ||
try { | ||
println("workflow private variable: ${events}") | ||
}catch (Exception e){ | ||
println("Can't access to a private workflow property") | ||
} | ||
if( workflow.success ) | ||
println("Success!") | ||
else | ||
println("Failure!") | ||
} | ||
|
||
throw new Exception("Workflow Failed!") | ||
} |