mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
41
test/integration/targets/handlers/from_handlers.yml
Normal file
41
test/integration/targets/handlers/from_handlers.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
- name: verify handlers_from on include_role
|
||||
hosts: A
|
||||
gather_facts: False
|
||||
connection: local
|
||||
tags: ['scenario1']
|
||||
tasks:
|
||||
- name: test include_role
|
||||
include_role: name=test_handlers_meta handlers_from=alternate.yml
|
||||
|
||||
- name: force handler run
|
||||
meta: flush_handlers
|
||||
|
||||
- name: verify handlers ran
|
||||
assert:
|
||||
that:
|
||||
- "'handler1_alt_called' in hostvars[inventory_hostname]"
|
||||
- "'handler2_alt_called' in hostvars[inventory_hostname]"
|
||||
tags: ['scenario1']
|
||||
|
||||
|
||||
- name: verify handlers_from on import_role
|
||||
hosts: A
|
||||
gather_facts: False
|
||||
connection: local
|
||||
tasks:
|
||||
- name: set facts to false
|
||||
set_fact:
|
||||
handler1_alt_called: False
|
||||
handler2_alt_called: False
|
||||
|
||||
- import_role: name=test_handlers_meta handlers_from=alternate.yml
|
||||
|
||||
- name: force handler run
|
||||
meta: flush_handlers
|
||||
|
||||
- name: verify handlers ran
|
||||
assert:
|
||||
that:
|
||||
- handler1_alt_called|bool
|
||||
- handler2_alt_called|bool
|
||||
tags: ['scenario1']
|
||||
@@ -0,0 +1,12 @@
|
||||
- name: set_handler_fact_1
|
||||
set_fact:
|
||||
handler1_called: True
|
||||
handler1_alt_called: True
|
||||
|
||||
- name: set_handler_fact_2
|
||||
set_fact:
|
||||
handler2_called: True
|
||||
handler2_alt_called: True
|
||||
|
||||
- name: count_handler
|
||||
shell: echo . >> {{ handler_countpath }}
|
||||
@@ -2,7 +2,12 @@
|
||||
|
||||
set -eux
|
||||
|
||||
# simple handler test
|
||||
ansible-playbook test_handlers.yml -i inventory.handlers -v "$@" --tags scenario1
|
||||
|
||||
# simple from_handlers test
|
||||
ansible-playbook from_handlers.yml -i inventory.handlers -v "$@" --tags scenario1
|
||||
|
||||
ansible-playbook test_listening_handlers.yml -i inventory.handlers -v "$@"
|
||||
|
||||
[ "$(ansible-playbook test_handlers.yml -i inventory.handlers -v "$@" --tags scenario2 -l A \
|
||||
|
||||
Reference in New Issue
Block a user