| |
@@ -25,15 +25,27 @@
|
| |
# Can't go in block. See
|
| |
# https://github.com/ansible/ansible/issues/20736
|
| |
- name: Check the results
|
| |
- shell: grep "^ERROR" {{ remote_artifacts }}/test.log
|
| |
- register: test_error
|
| |
- # Never fail at this step. Just store result of tests.
|
| |
- failed_when: False
|
| |
+ shell: |
|
| |
+ log="{{ remote_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_error: "{{ (test_error.stdout|d|length > 0) or (test_error.stderr|d|length > 0) }}"
|
| |
- role_result_msg: "{{ test_error.stdout|d('test execution error.') }}"
|
| |
+ role_result: "{{ test_results.stdout }}"
|
| |
+ role_message: "{{ test_results.stderr|d('test execution error.') }}"
|
| |
|
| |
- include_role:
|
| |
name: str-common-final
|
| |
Report role result task has been updated to show actual result of
testing, which means: ERROR upon any test execution problem, FAIL
when any test fails and PASS if there is at least one test passed.