summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/handlers/runme.sh
diff options
context:
space:
mode:
authorSloane Hertel <shertel@redhat.com>2019-12-19 20:10:51 +0100
committerSam Doran <sdoran@redhat.com>2019-12-19 20:10:51 +0100
commitc8704573396e7480b3e1b33b2ddda2b6325d0d80 (patch)
treec55460bb81f218521641fe5a5eed3cb8bed77985 /test/integration/targets/handlers/runme.sh
parentvmware/test: more modular teardown.yml (diff)
downloadansible-c8704573396e7480b3e1b33b2ddda2b6325d0d80.tar.xz
ansible-c8704573396e7480b3e1b33b2ddda2b6325d0d80.zip
free strategy - include failed hosts that were notified (#65576)
* free strategy - include failed hosts that were notified so --force-handlers is used * trim line length a bit * Loop over the force handler tests with the strategies linear and free * rename changelog * Use the play iterator instead of TQM for accurate failure representation in blocks * Remove hack in a backwards compatible way for 3rd party plugins
Diffstat (limited to 'test/integration/targets/handlers/runme.sh')
-rwxr-xr-xtest/integration/targets/handlers/runme.sh51
1 files changed, 30 insertions, 21 deletions
diff --git a/test/integration/targets/handlers/runme.sh b/test/integration/targets/handlers/runme.sh
index b87e342de4..59c81bcec0 100755
--- a/test/integration/targets/handlers/runme.sh
+++ b/test/integration/targets/handlers/runme.sh
@@ -17,33 +17,42 @@ ansible-playbook test_listening_handlers.yml -i inventory.handlers -v "$@"
[ "$(ansible-playbook test_handlers.yml -i inventory.handlers -v "$@" --tags scenario2 -l A \
| grep -E -o 'RUNNING HANDLER \[test_handlers : .*?]')" = "RUNNING HANDLER [test_handlers : test handler]" ]
-# Not forcing, should only run on successful host
-[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal \
-| grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_B" ]
+# Test forcing handlers using the linear and free strategy
+for strategy in linear free; do
-# Forcing from command line
-[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal --force-handlers \
-| grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
+ export ANSIBLE_STRATEGY=$strategy
-# Forcing from command line, should only run later tasks on unfailed hosts
-[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal --force-handlers \
-| grep -E -o CALLED_TASK_. | sort | uniq | xargs)" = "CALLED_TASK_B CALLED_TASK_D CALLED_TASK_E" ]
+ # Not forcing, should only run on successful host
+ [ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal \
+ | grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_B" ]
-# Forcing from command line, should call handlers even if all hosts fail
-[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal --force-handlers -e fail_all=yes \
-| grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
+ # Forcing from command line
+ [ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal --force-handlers \
+ | grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
-# Forcing from ansible.cfg
-[ "$(ANSIBLE_FORCE_HANDLERS=true ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal \
-| grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
+ # Forcing from command line, should only run later tasks on unfailed hosts
+ [ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal --force-handlers \
+ | grep -E -o CALLED_TASK_. | sort | uniq | xargs)" = "CALLED_TASK_B CALLED_TASK_D CALLED_TASK_E" ]
-# Forcing true in play
-[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags force_true_in_play \
-| grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
+ # Forcing from command line, should call handlers even if all hosts fail
+ [ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal --force-handlers -e fail_all=yes \
+ | grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
-# Forcing false in play, which overrides command line
-[ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags force_false_in_play --force-handlers \
-| grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_B" ]
+ # Forcing from ansible.cfg
+ [ "$(ANSIBLE_FORCE_HANDLERS=true ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags normal \
+ | grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
+
+ # Forcing true in play
+ [ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags force_true_in_play \
+ | grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_A CALLED_HANDLER_B" ]
+
+ # Forcing false in play, which overrides command line
+ [ "$(ansible-playbook test_force_handlers.yml -i inventory.handlers -v "$@" --tags force_false_in_play --force-handlers \
+ | grep -E -o CALLED_HANDLER_. | sort | uniq | xargs)" = "CALLED_HANDLER_B" ]
+
+ unset ANSIBLE_STRATEGY
+
+done
[ "$(ansible-playbook test_handlers_include.yml -i ../../inventory -v "$@" --tags playbook_include_handlers \
| grep -E -o 'RUNNING HANDLER \[.*?]')" = "RUNNING HANDLER [test handler]" ]