From 3f5aed056ba349e60de6143c537cbe49f5e44312 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Sat, 8 Feb 2020 12:41:06 -0500 Subject: [PATCH] Integration tests for notify with variable list (#66423) Co-authored-by: Luca Berruti Co-authored-by: lberruti --- .../handlers/main.yml | 6 ++++++ .../tasks/main.yml | 10 ++++++++++ .../handlers/test_templating_in_handlers.yml | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/test/integration/targets/handlers/roles/test_templating_in_handlers/handlers/main.yml b/test/integration/targets/handlers/roles/test_templating_in_handlers/handlers/main.yml index cc5b3a3d945..7dbf3347487 100644 --- a/test/integration/targets/handlers/roles/test_templating_in_handlers/handlers/main.yml +++ b/test/integration/targets/handlers/roles/test_templating_in_handlers/handlers/main.yml @@ -13,3 +13,9 @@ set_fact: role_templated_listener: True listen: "{{ handler4 }}" +- name: name5 + set_fact: + role_handler5: True +- set_fact: + role_handler6: True + listen: name6 diff --git a/test/integration/targets/handlers/roles/test_templating_in_handlers/tasks/main.yml b/test/integration/targets/handlers/roles/test_templating_in_handlers/tasks/main.yml index 47dbee3c73e..541741729f3 100644 --- a/test/integration/targets/handlers/roles/test_templating_in_handlers/tasks/main.yml +++ b/test/integration/targets/handlers/roles/test_templating_in_handlers/tasks/main.yml @@ -14,3 +14,13 @@ - role_templated_name is defined - role_non_templated_listener is defined - role_templated_listener is undefined + +- command: echo + notify: "{{ handler_list }}" + +- meta: flush_handlers + +- assert: + that: + - role_handler5 is defined + - role_handler6 is defined diff --git a/test/integration/targets/handlers/test_templating_in_handlers.yml b/test/integration/targets/handlers/test_templating_in_handlers.yml index b6aa71dfe6e..662b8c1efb4 100644 --- a/test/integration/targets/handlers/test_templating_in_handlers.yml +++ b/test/integration/targets/handlers/test_templating_in_handlers.yml @@ -6,6 +6,9 @@ handler2: name2 handler3: name3 handler4: name4 + handler_list: + - name5 + - name6 handlers: - name: name1 @@ -22,6 +25,12 @@ set_fact: templated_listener: True listen: "{{ handler4 }}" + - name: name5 + set_fact: + handler5: True + - set_fact: + handler6: True + listen: name6 tasks: - command: echo Hello World @@ -40,4 +49,14 @@ - non_templated_listener is defined - templated_listener is undefined + - command: echo + notify: "{{ handler_list }}" + + - meta: flush_handlers + + - assert: + that: + - handler5 is defined + - handler6 is defined + - include_role: name=test_templating_in_handlers