2020-04-27 14:47:40 +00:00
|
|
|
---
|
|
|
|
# Copied from standard-test-basic
|
2020-05-13 19:29:13 +00:00
|
|
|
# ...and, 2020-05-13, updated, looks like they changed the whole thing around
|
|
|
|
- name: Check the results
|
|
|
|
local_action:
|
|
|
|
module: shell
|
|
|
|
cmd: |
|
|
|
|
log="{{ artifacts }}/test.log"
|
|
|
|
if [ ! -f "$log" ]; then
|
|
|
|
echo ERROR
|
|
|
|
echo "Test results not found." 1>&2
|
|
|
|
elif grep ^ERROR "$log" 1>&2; then
|
|
|
|
echo ERROR
|
|
|
|
elif grep ^FAIL "$log" 1>&2; then
|
|
|
|
echo FAIL
|
|
|
|
elif grep -q ^PASS "$log"; then
|
|
|
|
echo PASS
|
|
|
|
else
|
|
|
|
echo ERROR
|
|
|
|
echo "No test results found." 1>&2
|
|
|
|
fi
|
|
|
|
register: test_results
|
2020-04-27 14:47:40 +00:00
|
|
|
|
2020-05-13 19:29:13 +00:00
|
|
|
- name: Set role result
|
2020-04-27 14:47:40 +00:00
|
|
|
set_fact:
|
2020-05-13 19:29:13 +00:00
|
|
|
role_result: "{{ test_results.stdout }}"
|
|
|
|
role_message: "{{ test_results.stderr|d('test execution error.') }}"
|
2020-04-27 14:47:40 +00:00
|
|
|
|
|
|
|
- name: display results
|
|
|
|
vars:
|
|
|
|
msg: |
|
2020-05-13 19:29:13 +00:00
|
|
|
role_result: {{ role_result|d('Undefined') }}
|
|
|
|
{{ role_message|d('[No error messages found]') }}
|
2020-04-27 14:47:40 +00:00
|
|
|
debug:
|
|
|
|
msg: "{{ msg.split('\n') }}"
|
2020-05-13 19:29:13 +00:00
|
|
|
failed_when: role_message|d("") != ""
|