summaryrefslogtreecommitdiff
path: root/test/utils
diff options
context:
space:
mode:
authorMatt Clay <mclay@redhat.com>2020-02-07 21:28:46 -0800
committerGitHub <noreply@github.com>2020-02-07 21:28:46 -0800
commita0242b217392b4e563cbcf7b704b0d166372a572 (patch)
treebc619b52a6a7d50327145c0be02654112560bdca /test/utils
parentf725dce9368dc4d33c2cddd4790c57e1d00496f0 (diff)
downloadansible-a0242b217392b4e563cbcf7b704b0d166372a572.tar.gz
Improve unit test handling in CI after migration. (#67217)
* Improve unit test handling in CI after migration. * Fix undefined var in bash 4.3 and earlier. See https://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES?id=3ba697465bc74fab513a26dea700cc82e9f4724e#n878
Diffstat (limited to 'test/utils')
-rwxr-xr-xtest/utils/shippable/units.sh20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/utils/shippable/units.sh b/test/utils/shippable/units.sh
index f743df5156..b6240d9502 100755
--- a/test/utils/shippable/units.sh
+++ b/test/utils/shippable/units.sh
@@ -44,17 +44,27 @@ networks=(
)
for network in "${networks[@]}"; do
- group1+=(--exclude "test/units/modules/network/${network}/")
- group2+=("test/units/modules/network/${network}/")
+ test_path="test/units/modules/network/${network}/"
+
+ if [ -d "${test_path}" ]; then
+ group1+=(--exclude "${test_path}")
+ group2+=("${test_path}")
+ fi
done
case "${group}" in
- 1) options=("${group1[@]}") ;;
- 2) options=("${group2[@]}") ;;
+ 1) options=("${group1[@]:+${group1[@]}}") ;;
+ 2) options=("${group2[@]:+${group2[@]}}") ;;
esac
+if [ ${#options[@]} -eq 0 ] && [ "${group}" -eq 2 ]; then
+ # allow collection migration unit tests for group 2 to "pass" without updating shippable.yml or this script during migration
+ echo "No unit tests found for group ${group}."
+ exit
+fi
+
ansible-test env --timeout "${timeout}" --color -v
# shellcheck disable=SC2086
ansible-test units --color -v --docker default --python "${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
- "${options[@]}" \
+ "${options[@]:+${options[@]}}" \