diff --git a/.papr.yml b/.papr.yml index 5a41c29..bdd4f03 100644 --- a/.papr.yml +++ b/.papr.yml @@ -11,10 +11,10 @@ context: centos/7/atomic/smoketested packages: - ansible + - git tests: - - ansible-playbook -vi testnode, common/ans_ah_head-1_deploy.yml - - ansible-playbook -vi testnode, tests/improved-sanity-test/main.yml + - ./.test_director --- inherit: true diff --git a/.test_director b/.test_director new file mode 100755 index 0000000..93f9637 --- /dev/null +++ b/.test_director @@ -0,0 +1,19 @@ +#!/bin/bash +set -xeuo pipefail + +# check commit +HEAD=${PAPR_COMMIT:-HEAD} +NEW_TESTS=( $(git diff --name-only origin/master..$HEAD | grep 'tests/.*/main.yml' || true) ) + +if [ ${#NEW_TESTS[@]} -eq 0 ]; then + ansible-playbook -vi testnode, common/ans_ah_head-1_deploy.yml + ansible-playbook -vi testnode, tests/improved-sanity-test/main.yml +else + printf '%s\n' "${NEW_TESTS[@]}" + for NEW_TEST in "${NEW_TESTS[@]}"; do + # diff may contain deleted tests so only run tests that exist + if [ -f $NEW_TEST ]; then + ansible-playbook -vi testnode, $NEW_TEST + fi + done +fi