diff --git a/tests/check_results.yml b/tests/check_results.yml index e873b8a..e1de3bd 100644 --- a/tests/check_results.yml +++ b/tests/check_results.yml @@ -1,21 +1,36 @@ --- # Copied from standard-test-basic -- name: check results - local_action: shell egrep "^(FAIL|ERROR)" "{{ artifacts }}/test.log" - register: test_fails - # Never fail at this step. Just store result of tests. - failed_when: False +# ...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: preserve results +- name: Set role result set_fact: - role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}" - role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}" + role_result: "{{ test_results.stdout }}" + role_message: "{{ test_results.stderr|d('test execution error.') }}" - name: display results vars: msg: | - Tests failed: {{ role_result_failed|d('Undefined') }} - Tests msg: {{ role_result_msg|d('None') }} + role_result: {{ role_result|d('Undefined') }} + {{ role_message|d('[No error messages found]') }} debug: msg: "{{ msg.split('\n') }}" - failed_when: "role_result_failed|bool" + failed_when: role_message|d("") != "" diff --git a/tests/roles/run_bats_tests/tasks/run_one_test.yml b/tests/roles/run_bats_tests/tasks/run_one_test.yml index 9304d21..9ef8cb7 100644 --- a/tests/roles/run_bats_tests/tasks/run_one_test.yml +++ b/tests/roles/run_bats_tests/tasks/run_one_test.yml @@ -71,3 +71,17 @@ - test.bats.log - test.summary.log - helper.sh + +# AAAAARGH! +# +# Fedora gating tests are failing, because str-common-final/tasks/main.yml +# tries to pull test.log and other logs from $remote_host:/tmp/artifacts . +# Those don't exist, because I track status and artifacts locally, because +# with the reboot I can't rely on /tmp being preserved. +# I see no way to tell str-common-final to skip this step; so let's just +# push logs over upon completion of each subtest. +- name: keep remote artifacts synced + synchronize: + src: "{{ artifacts }}/" + dest: "{{ remote_artifacts|d('/tmp/artifacts') }}/" + mode: push diff --git a/tests/test_podman.yml b/tests/test_podman.yml index 9caf564..1aacbbc 100644 --- a/tests/test_podman.yml +++ b/tests/test_podman.yml @@ -21,7 +21,7 @@ local_action: command truncate --size=0 {{ artifacts }}/test.log - name: clear test results (results.yml) - local_action: copy content="requires:\n" dest={{ artifacts }}/results.yml + local_action: copy content="results:\n" dest={{ artifacts }}/results.yml # These are the actual tests: set cgroups vN, then run root/rootless tests. - name: set cgroups and run podman tests