mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Mark tasks expected to fail with EXPECTED FAILURE.
This allows for automated identification of tasks which are expected to fail, but which cannot use ignore_errors because they need to fail.
This commit is contained in:
parent
126bc40ecf
commit
844b415066
4 changed files with 8 additions and 7 deletions
|
@ -10,15 +10,15 @@
|
||||||
- echoing handler
|
- echoing handler
|
||||||
when: inventory_hostname == 'A' or inventory_hostname == 'B'
|
when: inventory_hostname == 'A' or inventory_hostname == 'B'
|
||||||
|
|
||||||
- name: fail task for all
|
- name: EXPECTED FAILURE fail task for all
|
||||||
fail: msg="Fail All"
|
fail: msg="Fail All"
|
||||||
when: fail_all is defined and fail_all
|
when: fail_all is defined and fail_all
|
||||||
|
|
||||||
- name: fail task for A
|
- name: EXPECTED FAILURE fail task for A
|
||||||
fail: msg="Fail A"
|
fail: msg="Fail A"
|
||||||
when: inventory_hostname == 'A'
|
when: inventory_hostname == 'A'
|
||||||
|
|
||||||
- name: fail task for C
|
- name: EXPECTED FAILURE fail task for C
|
||||||
fail: msg="Fail C"
|
fail: msg="Fail C"
|
||||||
when: inventory_hostname == 'C'
|
when: inventory_hostname == 'C'
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
- fail: msg="{{msg}}"
|
- name: EXPECTED FAILURE
|
||||||
|
fail: msg="{{msg}}"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
- name: set block tasks run flag
|
- name: set block tasks run flag
|
||||||
set_fact:
|
set_fact:
|
||||||
block_tasks_run: true
|
block_tasks_run: true
|
||||||
- name: fail in tasks
|
- name: EXPECTED FAILURE fail in tasks
|
||||||
fail:
|
fail:
|
||||||
- name: tasks flag should not be set after failure
|
- name: tasks flag should not be set after failure
|
||||||
set_fact:
|
set_fact:
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
- name: set block rescue run flag
|
- name: set block rescue run flag
|
||||||
set_fact:
|
set_fact:
|
||||||
block_rescue_run: true
|
block_rescue_run: true
|
||||||
- name: fail in rescue
|
- name: EXPECTED FAILURE fail in rescue
|
||||||
fail:
|
fail:
|
||||||
- name: tasks flag should not be set after failure in rescue
|
- name: tasks flag should not be set after failure in rescue
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
- debug:
|
- debug:
|
||||||
msg: assert works ({{ assert_out.failed }})
|
msg: assert works ({{ assert_out.failed }})
|
||||||
|
|
||||||
- name: ensure fail action stops execution
|
- name: EXPECTED FAILURE ensure fail action stops execution
|
||||||
fail:
|
fail:
|
||||||
msg: fail actually failed (this is expected)
|
msg: fail actually failed (this is expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue