diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf46e51a4789d292723811f51ccc2fdfc4a82f2f..a1ce0b8f174efd94ea60d6d2e86ac4962970a506 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,8 +10,8 @@ test: # add code quality tests here # add unit tests here # add script tests here - - bash tests/test_scripts_table_to_snakemake/test.sh - - bash tests/test_scripts_labkey_to_snakemake/test.sh + - bash tests/test_scripts_labkey_to_snakemake_table/test.sh + - bash tests/test_scripts_labkey_to_snakemake_api/test.sh # add integration tests here - bash tests/test_create_dag_image/test.sh - bash tests/test_create_rule_graph/test.sh diff --git a/tests/test_create_dag_image/test.sh b/tests/test_create_dag_image/test.sh index 67bf41ce60e575401a044b2abc402f82ccd97522..0732292b15fe05802e9a7ef2a93f69e7c1b0ade9 100755 --- a/tests/test_create_dag_image/test.sh +++ b/tests/test_create_dag_image/test.sh @@ -1,7 +1,13 @@ #!/bin/bash # Tear down test environment -trap 'rm -rf .snakemake && cd $user_dir' EXIT # quotes command is exected after script exits, regardless of exit status +cleanup () { + rc=$? + rm -rf .snakemake + cd $user_dir + echo "Exit status: $rc" +} +trap cleanup EXIT # Set up test environment set -eo pipefail # ensures that script exits at first command that exits with non-zero status @@ -18,5 +24,6 @@ snakemake \ --dag \ --printshellcmds \ --dryrun \ + --verbose \ | dot -Tsvg > "../../images/dag_test_workflow.svg" diff --git a/tests/test_create_rule_graph/test.sh b/tests/test_create_rule_graph/test.sh index 00637f5b2b4ede083f3c26e9eb7277fe90a9df92..b232a2e53b840e99708010cd98e2dc07edf3f4ad 100755 --- a/tests/test_create_rule_graph/test.sh +++ b/tests/test_create_rule_graph/test.sh @@ -1,7 +1,13 @@ #!/bin/bash # Tear down test environment -trap 'rm -rf .snakemake && cd $user_dir' EXIT # quotes command is exected after script exits, regardless of exit status +cleanup () { + rc=$? + rm -rf .snakemake + cd $user_dir + echo "Exit status: $rc" +} +trap cleanup EXIT # Set up test environment set -eo pipefail # ensures that script exits at first command that exits with non-zero status @@ -18,5 +24,6 @@ snakemake \ --rulegraph \ --printshellcmds \ --dryrun \ + --verbose \ | dot -Tsvg > "../../images/rule_graph.svg" diff --git a/tests/test_integration_workflow/test.local.sh b/tests/test_integration_workflow/test.local.sh index 32923b4fd125c052389ac5dfbb2b7a5571d1b5fd..42e02fa41d021c0ffc7b7bcb33a02d18518f8dfd 100755 --- a/tests/test_integration_workflow/test.local.sh +++ b/tests/test_integration_workflow/test.local.sh @@ -1,7 +1,17 @@ #!/bin/bash # Tear down test environment -trap 'rm -rf logs/ results/ .snakemake/ .java/ local_log/ && cd $user_dir' EXIT # quoted command is exected after script exits, regardless of exit status +cleanup () { + rc=$? + rm -rf .java/ + rm -rf .snakemake/ + rm -rf local_log/ + rm -rf logs/ + rm -rf results/ + cd $user_dir + echo "Exit status: $rc" +} +trap cleanup EXIT # Set up test environment set -eo pipefail # ensures that script exits at first command that exits with non-zero status @@ -20,7 +30,8 @@ snakemake \ --printshellcmds \ --rerun-incomplete \ --use-singularity \ - --singularity-args="--bind ${PWD}/../input_files" + --singularity-args="--bind ${PWD}/../input_files" \ + --verbose # Check md5 sum of some output files find results/ -type f -name \*\.gz -exec gunzip '{}' \; diff --git a/tests/test_integration_workflow/test.slurm.sh b/tests/test_integration_workflow/test.slurm.sh index 7f773ee11bb7d4d66857d40ca883871983ac3593..67df1e9cc6929318c63d6081d7d19e4c5e133cea 100755 --- a/tests/test_integration_workflow/test.slurm.sh +++ b/tests/test_integration_workflow/test.slurm.sh @@ -1,7 +1,17 @@ #!/bin/bash # Tear down test environment -trap 'rm -rf logs/ results/ .snakemake/ .java/ local_log/ && cd $user_dir' EXIT # quoted command is exected after script exits, regardless of exit status +cleanup () { + rc=$? + rm -rf .java/ + rm -rf .snakemake/ + rm -rf local_log/ + rm -rf logs/ + rm -rf results/ + cd $user_dir + echo "Exit status: $rc" +} +trap cleanup EXIT # Set up test environment set -eo pipefail # ensures that script exits at first command that exits with non-zero status @@ -23,7 +33,8 @@ snakemake \ --printshellcmds \ --rerun-incomplete \ --use-singularity \ - --singularity-args="--bind ${PWD}/../input_files" + --singularity-args="--bind ${PWD}/../input_files" \ + --verbose # Check md5 sum of some output files find results/ -type f -name \*\.gz -exec gunzip '{}' \; diff --git a/tests/test_scripts_labkey_to_snakemake/expected_output.md5 b/tests/test_scripts_labkey_to_snakemake_api/expected_output.md5 similarity index 100% rename from tests/test_scripts_labkey_to_snakemake/expected_output.md5 rename to tests/test_scripts_labkey_to_snakemake_api/expected_output.md5 diff --git a/tests/test_scripts_labkey_to_snakemake/test.sh b/tests/test_scripts_labkey_to_snakemake_api/test.sh similarity index 84% rename from tests/test_scripts_labkey_to_snakemake/test.sh rename to tests/test_scripts_labkey_to_snakemake_api/test.sh index c9d1a275909b26286df47ec22914c8669eb26c4c..5658fd65444833935a066e4207c4d671181d2f60 100755 --- a/tests/test_scripts_labkey_to_snakemake/test.sh +++ b/tests/test_scripts_labkey_to_snakemake_api/test.sh @@ -4,7 +4,17 @@ # 'LABKEY_PASS' to be set with the appropriate values # Tear down test environment -trap 'rm -rf ${HOME}/.netrc .snakemake config.yaml samples.tsv input_table.tsv && cd $user_dir' EXIT # quotes command is exected after script exits, regardless of exit status +cleanup () { + rc=$? + rm -rf ${HOME}/.netrc + rm -rf .snakemake/ + rm -rf config.yaml + rm -rf input_table.tsv + rm -rf samples.tsv + cd $user_dir + echo "Exit status: $rc" +} +trap cleanup EXIT # Set up test environment set -eo pipefail # ensures that script exits at first command that exits with non-zero status @@ -36,6 +46,7 @@ snakemake \ --snakefile="../../Snakefile" \ --configfile="config.yaml" \ --dryrun \ + --verbose md5sum --check "expected_output.md5" # MD5 sums obtained with command: diff --git a/tests/test_scripts_table_to_snakemake/expected_output.md5 b/tests/test_scripts_labkey_to_snakemake_table/expected_output.md5 similarity index 100% rename from tests/test_scripts_table_to_snakemake/expected_output.md5 rename to tests/test_scripts_labkey_to_snakemake_table/expected_output.md5 diff --git a/tests/test_scripts_table_to_snakemake/input_table.tsv b/tests/test_scripts_labkey_to_snakemake_table/input_table.tsv similarity index 100% rename from tests/test_scripts_table_to_snakemake/input_table.tsv rename to tests/test_scripts_labkey_to_snakemake_table/input_table.tsv diff --git a/tests/test_scripts_table_to_snakemake/test.sh b/tests/test_scripts_labkey_to_snakemake_table/test.sh similarity index 84% rename from tests/test_scripts_table_to_snakemake/test.sh rename to tests/test_scripts_labkey_to_snakemake_table/test.sh index 63632e054b5c8e4f67aa62cf12e5d44452df9439..37014eda5e9fb41b564f6e4b78743c09511e5f3c 100755 --- a/tests/test_scripts_table_to_snakemake/test.sh +++ b/tests/test_scripts_labkey_to_snakemake_table/test.sh @@ -1,7 +1,15 @@ #!/bin/bash # Tear down test environment -trap 'rm -rf .snakemake config.yaml samples.tsv && cd $user_dir' EXIT # quotes command is exected after script exits, regardless of exit status +cleanup () { + rc=$? + rm -rf .snakemake/ + rm -rf config.yaml + rm -rf samples.tsv + cd $user_dir + echo "Exit status: $rc" +} +trap cleanup EXIT # Set up test environment set -eo pipefail # ensures that script exits at first command that exits with non-zero status @@ -25,6 +33,7 @@ snakemake \ --snakefile="../../Snakefile" \ --configfile="config.yaml" \ --dryrun \ + --verbose md5sum --check "expected_output.md5" # MD5 sums obtained with command: