Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
k8-cluster: explicitly fail based on test results
Browse files Browse the repository at this point in the history
I don't think Ansible considers handled exceptions as failures even
though it will display failures in the playbook summary. Lets
explicitly fail if any of the test results have failures.
  • Loading branch information
mike-nguyen authored and Micah Abbott committed Jun 18, 2018
1 parent 44347e9 commit 0f7487f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/k8-cluster/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@
local_action: copy content={{ tests | to_nice_yaml(indent=2) }} dest={{ result_file }}
become: false
tags: cleanup


# Handled exceptions show up as failures in Ansible but the playbook
# itself does not return 0, so explicitly fail the test by checking
# the test results
- name: Explicitly fail based on test results
when: item['result']|lower == "failed"
fail:
msg: "Failure found in test"
with_items: "{{ tests }}"

0 comments on commit 0f7487f

Please sign in to comment.