Skip to content
Snippets Groups Projects
Commit 0d95577e authored by Alex Kanitz's avatar Alex Kanitz
Browse files

run tests in verbose mode

- trap call functionalized through cleanup() function
- function added to all test scripts
- function prints out exit status of last command before trap
- flag `--verbose` added to Snakemake calls in all test scripts
- script tests rename to follow naming convention 'test_script_<script_name>_<script_run_mode>
parent ba39b976
No related branches found
No related tags found
1 merge request!29Add pipeline updates into MultiQC dev branch
......@@ -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
......
#!/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"
#!/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"
#!/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 '{}' \;
......
#!/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 '{}' \;
......
......@@ -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:
......
#!/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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment