Move meta_tasks test inventory into test.

This commit is contained in:
Matt Clay 2019-01-09 15:42:36 -08:00
parent 893548addb
commit dfc97dcefd
3 changed files with 6 additions and 3 deletions

View file

@ -0,0 +1,3 @@
[local]
testhost ansible_connection=local host_var_role_name=role3
testhost2 ansible_connection=local host_var_role_name=role2

View file

@ -4,7 +4,7 @@ set -eux
# test end_host meta task, with when conditional
for test_strategy in linear free; do
out="$(ansible-playbook test_end_host.yml -i ../../inventory -e test_strategy=$test_strategy -vv "$@")"
out="$(ansible-playbook test_end_host.yml -i inventory -e test_strategy=$test_strategy -vv "$@")"
grep -q "META: end_host conditional evaluated to false, continuing execution for testhost" <<< "$out"
grep -q "META: ending play for testhost2" <<< "$out"
@ -14,7 +14,7 @@ done
# test end_host meta task, on all hosts
for test_strategy in linear free; do
out="$(ansible-playbook test_end_host_all.yml -i ../../inventory -e test_strategy=$test_strategy -vv "$@")"
out="$(ansible-playbook test_end_host_all.yml -i inventory -e test_strategy=$test_strategy -vv "$@")"
grep -q "META: ending play for testhost" <<< "$out"
grep -q "META: ending play for testhost2" <<< "$out"

View file

@ -8,7 +8,7 @@
- debug:
- meta: end_host
when: "host_var_role_name == 'role2'" # end play for testhost2, see test/integration/inventory
when: "host_var_role_name == 'role2'" # end play for testhost2, see inventory
- debug:
msg: "play not ended for {{ inventory_hostname }}"