podman/tests/check_results.yml
Ed Santiago 5dd1bdae66 Yet more ansible muckery, to get test results
Looks like the code I copied from standard-test-roles
has changed; let's reincorporate it.

In particular, there is now an annoying step that pulls
logs and artifacts from remote-host:/tmp/artifacts .
Well, that doesn't exist in our case because /tmp may
not survive reboots. Workaround: after completion of
each test, push our local (master) artifacts to remote.

And, fix a typo in results.yml

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-05-14 07:14:13 -06:00

37 lines
1005 B
YAML

---
# Copied from standard-test-basic
# ...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
- name: Set role result
set_fact:
role_result: "{{ test_results.stdout }}"
role_message: "{{ test_results.stderr|d('test execution error.') }}"
- name: display results
vars:
msg: |
role_result: {{ role_result|d('Undefined') }}
{{ role_message|d('[No error messages found]') }}
debug:
msg: "{{ msg.split('\n') }}"
failed_when: role_message|d("") != ""