ansible/test/utils/shippable/windows.sh
Matt Clay cf1337ca9a Update ansible-test sanity command. (#31958)
* Use correct pip version in ansible-test.
* Add git fallback for validate-modules.
* Run sanity tests in a docker container.
* Use correct python version for sanity tests.
* Pin docker completion images and add default.
* Split pylint execution into multiple contexts.
* Only test .py files in use-argspec-type-path test.
* Accept identical python interpeter name or binary.
* Switch cloud tests to default container.
* Remove unused extras from pip install.
* Filter out empty pip commands.
* Don't force running of pip list.
* Support delegation for windows and network tests.
* Fix ansible-test python version usage.
* Fix ansible-test python version skipping.
* Use absolute path for log in ansible-test.
* Run vyos_command test on python 3.
* Fix windows/network instance persistence.
* Add `test/cache` dir to classification.
* Enable more python versions for network tests.
* Fix cs_router test.
2017-10-26 00:21:46 -07:00

73 lines
2.3 KiB
Bash
Executable file

#!/bin/bash -eux
set -o pipefail
declare -a args
IFS='/:' read -ra args <<< "$1"
target="windows/ci/group${args[1]}/"
# python versions to test in order
# python 2.7 runs full tests while other versions run minimal tests
python_versions=(
2.6
3.5
3.6
2.7
)
# shellcheck disable=SC2086
ansible-test windows-integration "${target}" --explain ${CHANGED:+"$CHANGED"} 2>&1 | { grep ' windows-integration: .* (targeted)$' || true; } > /tmp/windows.txt
if [ -s /tmp/windows.txt ] || [ "${CHANGED:+$CHANGED}" == "" ]; then
echo "Detected changes requiring integration tests specific to Windows:"
cat /tmp/windows.txt
echo "Running Windows integration tests for multiple versions concurrently."
platforms=(
--windows 2008-SP2
--windows 2008-R2_SP1
--windows 2012-RTM
--windows 2012-R2_RTM
)
else
echo "No changes requiring integration tests specific to Windows were detected."
echo "Running Windows integration tests for a single version only."
platforms=(
--windows 2012-R2_RTM
)
fi
for version in "${python_versions[@]}"; do
changed_all_target="all"
if [ "${version}" == "2.7" ]; then
# smoketest tests for python 2.7
if [ "${CHANGED}" ]; then
# with change detection enabled run tests for anything changed
# use the smoketest tests for any change that triggers all tests
ci="${target}"
if [ "${target}" == "windows/ci/group1/" ]; then
# only run smoketest tests for group1
changed_all_target="windows/ci/smoketest/"
else
# smoketest tests already covered by group1
changed_all_target="none"
fi
else
# without change detection enabled run entire test group
ci="${target}"
fi
else
# only run minimal tests for group1
if [ "${target}" != "windows/ci/group1/" ]; then continue; fi
# minimal tests for other python versions
ci="windows/ci/minimal/"
fi
# shellcheck disable=SC2086
ansible-test windows-integration --color -v --retry-on-error "${ci}" --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
"${platforms[@]}" --changed-all-target "${changed_all_target}"
done