2020-04-08 10:15:49 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux -o pipefail
|
|
|
|
|
|
|
|
cp -a "${TEST_DIR}/ansible_collections" "${WORK_DIR}"
|
|
|
|
cd "${WORK_DIR}/ansible_collections/ns/col"
|
|
|
|
|
2020-06-23 05:25:35 +02:00
|
|
|
# rename the sanity ignore file to match the current ansible version and update import ignores with the python version
|
|
|
|
ansible_version="$(python -c 'import ansible.release; print(".".join(ansible.release.__version__.split(".")[:2]))')"
|
2021-04-23 09:26:19 +02:00
|
|
|
if [[ "${ANSIBLE_TEST_PYTHON_VERSION}" =~ ^2\. ]] || [[ "${ANSIBLE_TEST_PYTHON_VERSION}" =~ ^3\.[567] ]]; then
|
|
|
|
# Non-module/module_utils plugins are not checked on these remote-only Python versions
|
2021-03-02 01:10:46 +01:00
|
|
|
sed "s/ import$/ import-${ANSIBLE_TEST_PYTHON_VERSION}/;" < "tests/sanity/ignore.txt" | grep -v 'plugins/[^m].* import' > "tests/sanity/ignore-${ansible_version}.txt"
|
|
|
|
else
|
|
|
|
sed "s/ import$/ import-${ANSIBLE_TEST_PYTHON_VERSION}/;" < "tests/sanity/ignore.txt" > "tests/sanity/ignore-${ansible_version}.txt"
|
|
|
|
fi
|
|
|
|
cat "tests/sanity/ignore-${ansible_version}.txt"
|
2020-06-23 05:25:35 +02:00
|
|
|
|
2020-04-08 10:15:49 +02:00
|
|
|
# common args for all tests
|
2020-06-09 22:38:36 +02:00
|
|
|
# each test will be run in a separate venv to verify that requirements have been properly specified
|
2020-04-08 10:15:49 +02:00
|
|
|
common=(--venv --python "${ANSIBLE_TEST_PYTHON_VERSION}" --color --truncate 0 "${@}")
|
|
|
|
|
2020-06-09 22:38:36 +02:00
|
|
|
# sanity tests
|
2020-04-08 10:15:49 +02:00
|
|
|
|
2020-06-09 22:38:36 +02:00
|
|
|
tests=()
|
|
|
|
|
|
|
|
set +x
|
|
|
|
|
|
|
|
while IFS='' read -r line; do
|
|
|
|
tests+=("$line");
|
|
|
|
done < <(
|
|
|
|
ansible-test sanity --list-tests
|
|
|
|
)
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
for test in "${tests[@]}"; do
|
|
|
|
rm -rf "tests/output"
|
|
|
|
ansible-test sanity "${common[@]}" --test "${test}"
|
|
|
|
done
|
|
|
|
|
|
|
|
# unit tests
|
|
|
|
|
|
|
|
rm -rf "tests/output"
|
2020-04-08 10:15:49 +02:00
|
|
|
ansible-test units "${common[@]}"
|
2020-06-09 22:38:36 +02:00
|
|
|
|
|
|
|
# integration tests
|
|
|
|
|
|
|
|
rm -rf "tests/output"
|
2020-04-08 10:15:49 +02:00
|
|
|
ansible-test integration "${common[@]}"
|