Refactor callbacks tests to allow multiple test cases

pull/81550/head
Mark Goddard 12 months ago
parent e458cbac61
commit 58355ad03e

@ -0,0 +1,9 @@
1 __init__
7 v2_on_any
1 v2_playbook_on_play_start
1 v2_playbook_on_start
1 v2_playbook_on_stats
1 v2_playbook_on_task_start
1 v2_runner_on_failed
1 v2_runner_on_ok
1 v2_runner_on_start

@ -0,0 +1,5 @@
- hosts: localhost
gather_facts: false
tasks:
- include_role:
name: does-not-exist

@ -2,14 +2,20 @@
set -eux
export ANSIBLE_CALLBACK_PLUGINS=../support-callback_plugins/callback_plugins
export ANSIBLE_ROLES_PATH=../
export ANSIBLE_CALLBACK_PLUGINS=../../support-callback_plugins/callback_plugins
export ANSIBLE_ROLES_PATH=../../
export ANSIBLE_STDOUT_CALLBACK=callback_debug
ANSIBLE_HOST_PATTERN_MISMATCH=warning ansible-playbook all-callbacks.yml 2>/dev/null | sort | uniq -c | tee callbacks_list.out
diff -w callbacks_list.out callbacks_list.expected
for strategy in linear free; do
ANSIBLE_STRATEGY=$strategy ansible-playbook include_role-fail.yml 2>/dev/null | sort | uniq -c | tee callback_list_include_role_fail.out
diff -w callback_list_include_role_fail.out callback_list_include_role_fail.expected
for testcase in */; do
echo "Testing $testcase"
pushd "$testcase"
# Execute in a subshell to isolate environment variables
(
if [[ -f env-vars ]]; then
source env-vars
fi
ansible-playbook test.yml 2>/dev/null | sort | uniq -c | tee callbacks_list.out
)
diff -w callbacks_list.out callbacks_list.expected
popd
done

Loading…
Cancel
Save