2018-11-14 15:46:25 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
|
|
|
# test end_host meta task, with when conditional
|
|
|
|
for test_strategy in linear free; do
|
2019-07-16 18:41:48 +02:00
|
|
|
out="$(ansible-playbook test_end_host.yml -i inventory.yml -e test_strategy=$test_strategy -vv "$@")"
|
2018-11-14 15:46:25 +01:00
|
|
|
|
|
|
|
grep -q "META: end_host conditional evaluated to false, continuing execution for testhost" <<< "$out"
|
|
|
|
grep -q "META: ending play for testhost2" <<< "$out"
|
2020-08-20 20:48:10 +02:00
|
|
|
grep -q '"skip_reason": "end_host conditional evaluated to False, continuing execution for testhost"' <<< "$out"
|
2018-11-14 15:46:25 +01:00
|
|
|
grep -q "play not ended for testhost" <<< "$out"
|
|
|
|
grep -qv "play not ended for testhost2" <<< "$out"
|
|
|
|
done
|
|
|
|
|
|
|
|
# test end_host meta task, on all hosts
|
|
|
|
for test_strategy in linear free; do
|
2019-07-16 18:41:48 +02:00
|
|
|
out="$(ansible-playbook test_end_host_all.yml -i inventory.yml -e test_strategy=$test_strategy -vv "$@")"
|
2018-11-14 15:46:25 +01:00
|
|
|
|
|
|
|
grep -q "META: ending play for testhost" <<< "$out"
|
|
|
|
grep -q "META: ending play for testhost2" <<< "$out"
|
|
|
|
grep -qv "play not ended for testhost" <<< "$out"
|
|
|
|
grep -qv "play not ended for testhost2" <<< "$out"
|
|
|
|
done
|
2019-07-16 18:41:48 +02:00
|
|
|
|
|
|
|
# test end_play meta task
|
|
|
|
for test_strategy in linear free; do
|
|
|
|
out="$(ansible-playbook test_end_play.yml -i inventory.yml -e test_strategy=$test_strategy -vv "$@")"
|
|
|
|
|
|
|
|
grep -q "META: ending play" <<< "$out"
|
|
|
|
grep -qv 'Failed to end using end_play' <<< "$out"
|
|
|
|
done
|