mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Move meta_tasks test inventory into test.
This commit is contained in:
3
test/integration/targets/meta_tasks/inventory
Normal file
3
test/integration/targets/meta_tasks/inventory
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[local]
|
||||||
|
testhost ansible_connection=local host_var_role_name=role3
|
||||||
|
testhost2 ansible_connection=local host_var_role_name=role2
|
||||||
@@ -4,7 +4,7 @@ set -eux
|
|||||||
|
|
||||||
# test end_host meta task, with when conditional
|
# test end_host meta task, with when conditional
|
||||||
for test_strategy in linear free; do
|
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: end_host conditional evaluated to false, continuing execution for testhost" <<< "$out"
|
||||||
grep -q "META: ending play for testhost2" <<< "$out"
|
grep -q "META: ending play for testhost2" <<< "$out"
|
||||||
@@ -14,7 +14,7 @@ done
|
|||||||
|
|
||||||
# test end_host meta task, on all hosts
|
# test end_host meta task, on all hosts
|
||||||
for test_strategy in linear free; do
|
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 testhost" <<< "$out"
|
||||||
grep -q "META: ending play for testhost2" <<< "$out"
|
grep -q "META: ending play for testhost2" <<< "$out"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
- debug:
|
- debug:
|
||||||
|
|
||||||
- meta: end_host
|
- 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:
|
- debug:
|
||||||
msg: "play not ended for {{ inventory_hostname }}"
|
msg: "play not ended for {{ inventory_hostname }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user