From 25245630d2a16086b285637c387d6dfbe252e798 Mon Sep 17 00:00:00 2001 From: cat-bro Date: Wed, 21 Oct 2020 22:33:42 +1100 Subject: [PATCH 1/2] test script and venv requirements --- .gitignore | 1 + requirements.txt | 2 ++ run_galaxy_workflow_tests.sh | 3 ++- test_workflows.sh | 37 ++++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 requirements.txt create mode 100644 test_workflows.sh diff --git a/.gitignore b/.gitignore index 9510cd3..f68fbd1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .venv/ tool_test_output.* +.secret.env diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f24c692 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +planemo==0.72.0 +galaxy-parsec==1.13.0 diff --git a/run_galaxy_workflow_tests.sh b/run_galaxy_workflow_tests.sh index 1438719..13937ec 100755 --- a/run_galaxy_workflow_tests.sh +++ b/run_galaxy_workflow_tests.sh @@ -14,6 +14,7 @@ planemo $PLANEMO_OPTIONS test \ --galaxy_user_key "$GALAXY_USER_KEY" \ --no_shed_install \ --engine external_galaxy \ + --test_output_json test_output.json \ "$1"; planemo_exit_code=$? set -e @@ -26,6 +27,6 @@ else # Otherwise immediately delete history_id=$(parsec histories get_histories --name "$history_name" | jq -r .[0].id) parsec histories delete_history --purge $history_id - echo "Test was completely successful"> history.html + echo "Test was completely successful" > history.html fi exit $planemo_exit_code diff --git a/test_workflows.sh b/test_workflows.sh new file mode 100644 index 0000000..0c19338 --- /dev/null +++ b/test_workflows.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# if GALAXY_URL and GALAXY_USER_KEY are not set, try to set them from local untracked file +[ ! $GALAXY_URL ] || [ ! $GALAXY_USER_KEY ] && source .secret.env +export GALAXY_URL GALAXY_USER_KEY + +virtualenv -p python3 .venv; . .venv/bin/activate +pip install -r requirements.txt + +# initalise parsec with url and api key. Remove any existing parsec configuration stored in the home directory +rm -f ~/.parsec.yml ||: +parsec init --url $GALAXY_URL --api_key $GALAXY_USER_KEY # caution: if ~/.parsec.yml already exists at this point it will not be updated + +workflow_list=workflows_to_test.txt +# # get list of local workflows with tests (ignoring training folder) +find . \( -name '*-test.yml' ! -path './training*' \) | sed 's/^\.\///g' | sed 's/-test.yml/.ga/g' > $workflow_list + +# # clone training-material repo +git clone --depth 1 https://github.com/galaxyproject/training-material.git + +# # get list of training-material workflows with tests +find 'training-material' -path '*-test.yml' | sed 's/-test.yml/.ga/g' >> $workflow_list + +[ -d test_output ] && rm -rf test_output +mkdir test_output + +# run test for each workflow and store json report +cat $workflow_list | while read line || [[ -n $line ]]; do + ./run_galaxy_workflow_tests.sh $line + mv test_output.json test_output/$(sed 's/\//__/g' <<< $line).test_output.json + mv history.html test_output/$(sed 's/\//__/g' <<< $line).history.html +done + +# merge json reports and create html report from merged report +find 'test_output' -name '*test_output.json' -exec sh -c 'planemo merge_test_reports "$@" test_output/merged_test_output.json' sh {} + +planemo test_reports test_output/merged_test_output.json --test_output merged_test_output.html + From a9b4ba090ad1e88563913617b5ebcab07c70decd Mon Sep 17 00:00:00 2001 From: cat-bro Date: Thu, 22 Oct 2020 00:49:07 +1100 Subject: [PATCH 2/2] remove parsec init, venv creation and sourcing of variables --- .gitignore | 1 - test_workflows.sh | 11 ----------- 2 files changed, 12 deletions(-) diff --git a/.gitignore b/.gitignore index f68fbd1..9510cd3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .venv/ tool_test_output.* -.secret.env diff --git a/test_workflows.sh b/test_workflows.sh index 0c19338..6558762 100644 --- a/test_workflows.sh +++ b/test_workflows.sh @@ -1,16 +1,5 @@ #!/bin/bash -# if GALAXY_URL and GALAXY_USER_KEY are not set, try to set them from local untracked file -[ ! $GALAXY_URL ] || [ ! $GALAXY_USER_KEY ] && source .secret.env -export GALAXY_URL GALAXY_USER_KEY - -virtualenv -p python3 .venv; . .venv/bin/activate -pip install -r requirements.txt - -# initalise parsec with url and api key. Remove any existing parsec configuration stored in the home directory -rm -f ~/.parsec.yml ||: -parsec init --url $GALAXY_URL --api_key $GALAXY_USER_KEY # caution: if ~/.parsec.yml already exists at this point it will not be updated - workflow_list=workflows_to_test.txt # # get list of local workflows with tests (ignoring training folder) find . \( -name '*-test.yml' ! -path './training*' \) | sed 's/^\.\///g' | sed 's/-test.yml/.ga/g' > $workflow_list