summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/blocks
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2020-08-26 07:07:34 +0200
committerGitHub <noreply@github.com>2020-08-26 07:07:34 +0200
commit9792d631b1b92356d41e9a792de4b2479a1bce44 (patch)
tree34a6be0a4963fcd2dcb53b2a8aa892215d8a8058 /test/integration/targets/blocks
parentFix ansible-test coverage traceback. (#71446) (diff)
downloadansible-9792d631b1b92356d41e9a792de4b2479a1bce44.tar.xz
ansible-9792d631b1b92356d41e9a792de4b2479a1bce44.zip
_check_failed_state: always use the current/nested state (#71347)
Fixes #71306
Diffstat (limited to 'test/integration/targets/blocks')
-rw-r--r--test/integration/targets/blocks/issue71306.yml16
-rwxr-xr-xtest/integration/targets/blocks/runme.sh9
2 files changed, 25 insertions, 0 deletions
diff --git a/test/integration/targets/blocks/issue71306.yml b/test/integration/targets/blocks/issue71306.yml
new file mode 100644
index 0000000000..9762f6ee83
--- /dev/null
+++ b/test/integration/targets/blocks/issue71306.yml
@@ -0,0 +1,16 @@
+- hosts: all
+ gather_facts: no
+ tasks:
+ - block:
+ - block:
+ - block:
+ - name: EXPECTED FAILURE
+ fail:
+ when: ansible_host == "host1"
+
+ - debug:
+ msg: "I am successful!"
+ run_once: true
+ rescue:
+ - debug:
+ msg: "Attemp 1 failed!"
diff --git a/test/integration/targets/blocks/runme.sh b/test/integration/targets/blocks/runme.sh
index 038e5a64fd..3fcdf202d8 100755
--- a/test/integration/targets/blocks/runme.sh
+++ b/test/integration/targets/blocks/runme.sh
@@ -84,3 +84,12 @@ cat rc_test.out
[ "$(grep -c 'rescued=3' rc_test.out)" -eq 1 ]
[ "$(grep -c 'failed=0' rc_test.out)" -eq 1 ]
rm -f rc_test.out
+
+# https://github.com/ansible/ansible/issues/71306
+set +e
+exit_code=0
+ansible-playbook -i host1,host2 -vv issue71306.yml > rc_test.out || exit_code=$?
+set -e
+cat rc_test.out
+[ $exit_code -eq 0 ]
+rm -f rc_test_out