1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Update failed_when integration test to be more thorough

This commit is contained in:
James Cammarata 2015-06-05 07:25:37 -04:00
parent 423f1233c8
commit d913f169a8

View file

@ -16,13 +16,54 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: Test failed_when behavior but catch it.
command: /bin/true
failed_when: 2 != 3
register: failed
- name: command rc 0 failed_when_result undef
shell: exit 0
ignore_errors: True
register: result
- name: Assert that failed_when is true.
assert:
- assert:
that:
- "failed.failed_when_result == True"
- "'failed' not in result"
- name: command rc 0 failed_when_result False
shell: exit 0
failed_when: false
ignore_errors: true
register: result
- assert:
that:
- "'failed' in result and not result.failed"
- "'failed_when_result' in result and not result.failed_when_result"
- name: command rc 1 failed_when_result True
shell: exit 1
failed_when: true
ignore_errors: true
register: result
- assert:
that:
- "'failed' in result and result.failed"
- "'failed_when_result' in result and result.failed_when_result"
- name: command rc 1 failed_when_result undef
shell: exit 1
ignore_errors: true
register: result
- assert:
that:
- "'failed' not in result"
- name: command rc 1 failed_when_result False
shell: exit 1
failed_when: false
ignore_errors: true
register: result
- assert:
that:
- "'failed' in result and not result.failed"
- "'failed_when_result' in result and not result.failed_when_result"