2020-03-29 18:04:27 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-04-08 10:15:49 +02:00
|
|
|
set -eu -o pipefail
|
2020-03-29 18:04:27 +02:00
|
|
|
|
|
|
|
# tests must be executed outside of the ansible source tree
|
|
|
|
# otherwise ansible-test will test the ansible source instead of the test collection
|
|
|
|
# the temporary directory provided by ansible-test resides within the ansible source tree
|
|
|
|
tmp_dir=$(mktemp -d)
|
|
|
|
|
|
|
|
trap 'rm -rf "${tmp_dir}"' EXIT
|
|
|
|
|
2020-04-08 10:15:49 +02:00
|
|
|
export TEST_DIR
|
|
|
|
export WORK_DIR
|
2020-03-29 18:04:27 +02:00
|
|
|
|
2020-04-08 10:15:49 +02:00
|
|
|
TEST_DIR="$PWD"
|
2020-03-29 18:04:27 +02:00
|
|
|
|
2020-04-08 10:15:49 +02:00
|
|
|
for test in collection-tests/*.sh; do
|
|
|
|
WORK_DIR="${tmp_dir}/$(basename "${test}" ".sh")"
|
|
|
|
mkdir "${WORK_DIR}"
|
|
|
|
echo "**********************************************************************"
|
|
|
|
echo "TEST: ${test}: STARTING"
|
|
|
|
"${test}" "${@}" || (echo "TEST: ${test}: FAILED" && exit 1)
|
|
|
|
echo "TEST: ${test}: PASSED"
|
|
|
|
done
|