Commit d913f169 by James Cammarata

Update failed_when integration test to be more thorough

parent 423f1233
...@@ -16,13 +16,54 @@ ...@@ -16,13 +16,54 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: Test failed_when behavior but catch it. - name: command rc 0 failed_when_result undef
command: /bin/true shell: exit 0
failed_when: 2 != 3
register: failed
ignore_errors: True ignore_errors: True
register: result
- name: Assert that failed_when is true. - assert:
assert:
that: that:
- "failed.failed_when_result == True" - "'failed' not in result"
\ No newline at end of file
- 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"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment