summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorBrian Coca <bcoca@users.noreply.github.com>2021-03-03 22:11:09 +0100
committerGitHub <noreply@github.com>2021-03-03 22:11:09 +0100
commitce1de28061414c54ab95053fd642a02e9acd9079 (patch)
tree2c89a5f98afdb5d38c7c6bd8e58d5730eb7c1e05 /test/integration
parentfinish migrating ssh plugin to config system (#73708) (diff)
downloadansible-ce1de28061414c54ab95053fd642a02e9acd9079.tar.xz
ansible-ce1de28061414c54ab95053fd642a02e9acd9079.zip
Fix notify on import_tasks (#73572)
* Fix notify on import_tasks also able to apply to blocks now.
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/targets/blocks/inherit_notify.yml19
-rwxr-xr-xtest/integration/targets/blocks/runme.sh3
-rw-r--r--test/integration/targets/import_tasks/aliases2
-rw-r--r--test/integration/targets/import_tasks/inherit_notify.yml15
-rwxr-xr-xtest/integration/targets/import_tasks/runme.sh5
-rw-r--r--test/integration/targets/import_tasks/tasks/trigger_change.yml2
-rw-r--r--test/integration/targets/includes/inherit_notify.yml18
-rwxr-xr-xtest/integration/targets/includes/runme.sh2
-rw-r--r--test/integration/targets/includes/tasks/trigger_change.yml2
9 files changed, 68 insertions, 0 deletions
diff --git a/test/integration/targets/blocks/inherit_notify.yml b/test/integration/targets/blocks/inherit_notify.yml
new file mode 100644
index 0000000000..d8e87423df
--- /dev/null
+++ b/test/integration/targets/blocks/inherit_notify.yml
@@ -0,0 +1,19 @@
+- hosts: localhost
+ gather_facts: false
+ tasks:
+ - name: test notify inheritance in block
+ notify: hello
+ block:
+ - debug: msg='trigger it'
+ changed_when: true
+
+ handlers:
+ - name: hello
+ set_fact: hello=world
+
+ post_tasks:
+ - name: ensure handler ran
+ assert:
+ that:
+ - hello is defined
+ - "hello == 'world'"
diff --git a/test/integration/targets/blocks/runme.sh b/test/integration/targets/blocks/runme.sh
index 535126835d..63bcd3fc3c 100755
--- a/test/integration/targets/blocks/runme.sh
+++ b/test/integration/targets/blocks/runme.sh
@@ -100,3 +100,6 @@ cat role_complete_test.out
[ "$(grep -c 'Tagged task' role_complete_test.out)" -eq 2 ]
[ "$(grep -c 'Not tagged task' role_complete_test.out)" -eq 0 ]
rm -f role_complete_test.out
+
+# test notify inheritance
+ansible-playbook inherit_notify.yml "$@"
diff --git a/test/integration/targets/import_tasks/aliases b/test/integration/targets/import_tasks/aliases
new file mode 100644
index 0000000000..fff62d9f20
--- /dev/null
+++ b/test/integration/targets/import_tasks/aliases
@@ -0,0 +1,2 @@
+shippable/posix/group5
+skip/aix
diff --git a/test/integration/targets/import_tasks/inherit_notify.yml b/test/integration/targets/import_tasks/inherit_notify.yml
new file mode 100644
index 0000000000..cf418f9df3
--- /dev/null
+++ b/test/integration/targets/import_tasks/inherit_notify.yml
@@ -0,0 +1,15 @@
+- hosts: localhost
+ gather_facts: false
+ pre_tasks:
+ - import_tasks: tasks/trigger_change.yml
+ notify: hello
+
+ handlers:
+ - name: hello
+ set_fact: hello=world
+
+ tasks:
+ - name: ensure handler ran
+ assert:
+ that:
+ - "hello is defined and hello == 'world'"
diff --git a/test/integration/targets/import_tasks/runme.sh b/test/integration/targets/import_tasks/runme.sh
new file mode 100755
index 0000000000..ea3529b5c9
--- /dev/null
+++ b/test/integration/targets/import_tasks/runme.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+set -eux
+
+ansible-playbook inherit_notify.yml "$@"
diff --git a/test/integration/targets/import_tasks/tasks/trigger_change.yml b/test/integration/targets/import_tasks/tasks/trigger_change.yml
new file mode 100644
index 0000000000..6ee4551521
--- /dev/null
+++ b/test/integration/targets/import_tasks/tasks/trigger_change.yml
@@ -0,0 +1,2 @@
+- debug: msg="I trigger changed!"
+ changed_when: true
diff --git a/test/integration/targets/includes/inherit_notify.yml b/test/integration/targets/includes/inherit_notify.yml
new file mode 100644
index 0000000000..f868be16ee
--- /dev/null
+++ b/test/integration/targets/includes/inherit_notify.yml
@@ -0,0 +1,18 @@
+- hosts: localhost
+ gather_facts: false
+ pre_tasks:
+ - include_tasks:
+ file: tasks/trigger_change.yml
+ apply:
+ notify: hello
+
+ handlers:
+ - name: hello
+ set_fact: hello=world
+
+ tasks:
+ - name: ensure handler ran
+ assert:
+ that:
+ - hello is defined
+ - "hello == 'world'"
diff --git a/test/integration/targets/includes/runme.sh b/test/integration/targets/includes/runme.sh
index dff40029b1..70ff105bd1 100755
--- a/test/integration/targets/includes/runme.sh
+++ b/test/integration/targets/includes/runme.sh
@@ -3,3 +3,5 @@
set -eux
ansible-playbook test_includes.yml -i ../../inventory "$@"
+
+ansible-playbook inherit_notify.yml "$@"
diff --git a/test/integration/targets/includes/tasks/trigger_change.yml b/test/integration/targets/includes/tasks/trigger_change.yml
new file mode 100644
index 0000000000..6ee4551521
--- /dev/null
+++ b/test/integration/targets/includes/tasks/trigger_change.yml
@@ -0,0 +1,2 @@
+- debug: msg="I trigger changed!"
+ changed_when: true