fix any_errors_fatal tests (#83389)

* fix any_errors_fatal test to exit on non-zero rc

Use a typo in the debug msg to avoid matching play recap

* remove duplicate 'set -ux'
pull/83404/head
Sloane Hertel 6 months ago committed by GitHub
parent 70c2b35210
commit 68638f4710
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -11,7 +11,7 @@
rescue: rescue:
- name: Rescues both hosts - name: Rescues both hosts
debug: debug:
msg: rescue msg: rescuedd
- name: You can recover from fatal errors by adding a rescue section to the block. - name: You can recover from fatal errors by adding a rescue section to the block.
debug: debug:
msg: recovered msg: recovered

@ -15,8 +15,6 @@ if [ "${res}" -eq 0 ] ; then
exit 1 exit 1
fi fi
set -ux
ansible-playbook -i inventory "$@" always_block.yml | tee out.txt | grep 'any_errors_fatal_always_block_start' ansible-playbook -i inventory "$@" always_block.yml | tee out.txt | grep 'any_errors_fatal_always_block_start'
res=$? res=$?
cat out.txt cat out.txt
@ -25,8 +23,6 @@ if [ "${res}" -ne 0 ] ; then
exit 1 exit 1
fi fi
set -ux
for test_name in test_include_role test_include_tasks; do for test_name in test_include_role test_include_tasks; do
ansible-playbook -i inventory "$@" -e test_name=$test_name 50897.yml | tee out.txt | grep 'any_errors_fatal_this_should_never_be_reached' ansible-playbook -i inventory "$@" -e test_name=$test_name 50897.yml | tee out.txt | grep 'any_errors_fatal_this_should_never_be_reached'
res=$? res=$?
@ -36,6 +32,8 @@ for test_name in test_include_role test_include_tasks; do
fi fi
done done
set -e
ansible-playbook -i inventory "$@" 31543.yml | tee out.txt ansible-playbook -i inventory "$@" 31543.yml | tee out.txt
[ "$(grep -c 'SHOULD NOT HAPPEN' out.txt)" -eq 0 ] [ "$(grep -c 'SHOULD NOT HAPPEN' out.txt)" -eq 0 ]
@ -47,5 +45,5 @@ ansible-playbook -i inventory "$@" 73246.yml | tee out.txt
ansible-playbook -i inventory "$@" 80981.yml | tee out.txt ansible-playbook -i inventory "$@" 80981.yml | tee out.txt
[ "$(grep -c 'SHOULD NOT HAPPEN' out.txt)" -eq 0 ] [ "$(grep -c 'SHOULD NOT HAPPEN' out.txt)" -eq 0 ]
[ "$(grep -c 'rescue' out.txt)" -eq 2 ] [ "$(grep -c 'rescuedd' out.txt)" -eq 2 ]
[ "$(grep -c 'recovered' out.txt)" -eq 2 ] [ "$(grep -c 'recovered' out.txt)" -eq 2 ]

Loading…
Cancel
Save