mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
improve test_test_infra debug messaging, rc check
This commit is contained in:
parent
f82639e4a2
commit
6578e63e63
2 changed files with 9 additions and 5 deletions
|
@ -26,7 +26,8 @@ EUID := $(shell id -u -r)
|
||||||
all: setup test_test_infra parsing test_var_precedence unicode test_templating_settings environment non_destructive destructive includes blocks pull check_mode test_hash test_handlers test_group_by test_vault test_tags test_lookup_paths no_log test_connection test_gathering_facts
|
all: setup test_test_infra parsing test_var_precedence unicode test_templating_settings environment non_destructive destructive includes blocks pull check_mode test_hash test_handlers test_group_by test_vault test_tags test_lookup_paths no_log test_connection test_gathering_facts
|
||||||
|
|
||||||
test_test_infra:
|
test_test_infra:
|
||||||
[ "$$(ansible-playbook -i $(INVENTORY) test_test_infra.yml -e @$(VARS_FILE) $(CREDENTIALS_ARG) $(TEST_FLAGS) | fgrep works | xargs)" = "msg: fail works (True) msg: assert works (True)" ]
|
# ensure fail/assert work and can stop execution with non-zero exit code
|
||||||
|
PB_OUT=$$(ansible-playbook -i $(INVENTORY) test_test_infra.yml -e @$(VARS_FILE) $(CREDENTIALS_ARG) $(TEST_FLAGS)) ; APB_RC=$$? ; echo "$$PB_OUT" ; echo "rc was $$APB_RC (must be non-zero)" ; [ $$APB_RC -ne 0 ]
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
rm -rf $(TEST_DIR)
|
rm -rf $(TEST_DIR)
|
||||||
|
|
|
@ -3,14 +3,16 @@
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
tasks:
|
tasks:
|
||||||
- fail:
|
- name: ensure fail action produces a failing result
|
||||||
|
fail:
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
register: fail_out
|
register: fail_out
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: fail works ({{ fail_out.failed }})
|
msg: fail works ({{ fail_out.failed }})
|
||||||
|
|
||||||
- assert:
|
- name: ensure assert produces a failing result
|
||||||
|
assert:
|
||||||
that: false
|
that: false
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
register: assert_out
|
register: assert_out
|
||||||
|
@ -18,6 +20,7 @@
|
||||||
- debug:
|
- debug:
|
||||||
msg: assert works ({{ assert_out.failed }})
|
msg: assert works ({{ assert_out.failed }})
|
||||||
|
|
||||||
- fail:
|
- name: ensure fail action stops execution
|
||||||
msg: fail actually failed
|
fail:
|
||||||
|
msg: fail actually failed (this is expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue