Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

[WIP] test script and venv requirements #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.venv/
tool_test_output.*
.secret.env
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
planemo==0.72.0
galaxy-parsec==1.13.0
3 changes: 2 additions & 1 deletion run_galaxy_workflow_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 "<html><head></head><body>Test was completely successful</body></html>"> history.html
echo "<html><head></head><body>Test was completely successful</body></html>" > history.html
fi
exit $planemo_exit_code
37 changes: 37 additions & 0 deletions test_workflows.sh
Original file line number Diff line number Diff line change
@@ -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
cat-bro marked this conversation as resolved.
Show resolved Hide resolved
export GALAXY_URL GALAXY_USER_KEY

virtualenv -p python3 .venv; . .venv/bin/activate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On jenkins this is done through a plugin that creates a venv (shining panda), so this step isn't necessary. But the pip install is useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to pip install -r requirements.txt within code on jenkins

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 ||:
cat-bro marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
workflow_list=workflows_to_test.txt
workflow_list=$(mktemp)

# # 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen this construction before, cool! 👍

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 {} +
hexylena marked this conversation as resolved.
Show resolved Hide resolved
planemo test_reports test_output/merged_test_output.json --test_output merged_test_output.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged test reports will be SO much nicer!!