summaryrefslogtreecommitdiff
path: root/test/integration/targets/handlers
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2016-11-13 01:26:43 -0600
committerJames Cammarata <jimi@sngx.net>2016-11-13 15:24:44 -0600
commit4f06a861618953686672213500a3dba58168f65b (patch)
tree1d2566952efe347bfda77f9e1806d98ef060565c /test/integration/targets/handlers
parent527d8307c133100a3ca585589d590c598608ef07 (diff)
downloadansible-4f06a861618953686672213500a3dba58168f65b.tar.gz
Alternately track listening handlers by uuid if no name is set
Fixes #17846
Diffstat (limited to 'test/integration/targets/handlers')
-rwxr-xr-xtest/integration/targets/handlers/runme.sh1
-rw-r--r--test/integration/targets/handlers/test_handlers.yml25
-rw-r--r--test/integration/targets/handlers/test_listening_handlers.yml25
3 files changed, 51 insertions, 0 deletions
diff --git a/test/integration/targets/handlers/runme.sh b/test/integration/targets/handlers/runme.sh
index b1af33b335..9b709de326 100755
--- a/test/integration/targets/handlers/runme.sh
+++ b/test/integration/targets/handlers/runme.sh
@@ -3,6 +3,7 @@
set -eux
ansible-playbook test_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 \
| egrep -o 'RUNNING HANDLER \[test_handlers : .*?]')" = "RUNNING HANDLER [test_handlers : test handler]" ]
diff --git a/test/integration/targets/handlers/test_handlers.yml b/test/integration/targets/handlers/test_handlers.yml
index 87d04b6c90..142eeb387d 100644
--- a/test/integration/targets/handlers/test_handlers.yml
+++ b/test/integration/targets/handlers/test_handlers.yml
@@ -18,6 +18,31 @@
- "'handler2_called' in hostvars[inventory_hostname]"
tags: ['scenario1']
+- name: verify listening handlers
+ hosts: A
+ gather_facts: False
+ connection: local
+ tasks:
+ - name: notify some handlers
+ command: echo foo
+ notify:
+ - notify_listen
+ post_tasks:
+ - name: assert all defined handlers ran without error
+ assert:
+ that:
+ - "notify_listen_ran_1 is defined"
+ - "notify_listen_ran_2 is defined"
+ handlers:
+ - name: first listening handler has a name
+ set_fact:
+ notify_listen_ran_1: True
+ listen: notify_listen
+ # second listening handler does not
+ - set_fact:
+ notify_listen_ran_2: True
+ listen: notify_listen
+
- name: test handlers
hosts: testgroup
gather_facts: False
diff --git a/test/integration/targets/handlers/test_listening_handlers.yml b/test/integration/targets/handlers/test_listening_handlers.yml
new file mode 100644
index 0000000000..6500f02cfb
--- /dev/null
+++ b/test/integration/targets/handlers/test_listening_handlers.yml
@@ -0,0 +1,25 @@
+---
+- name: verify listening handlers
+ hosts: A
+ gather_facts: False
+ connection: local
+ tasks:
+ - name: notify some handlers
+ command: echo foo
+ notify:
+ - notify_listen
+ post_tasks:
+ - name: assert all defined handlers ran without error
+ assert:
+ that:
+ - "notify_listen_ran_1 is defined"
+ - "notify_listen_ran_2 is defined"
+ handlers:
+ - name: first listening handler has a name
+ set_fact:
+ notify_listen_ran_1: True
+ listen: notify_listen
+ # second listening handler does not
+ - set_fact:
+ notify_listen_ran_2: True
+ listen: notify_listen