debian-forge-composer/schutzbot/test_runner_image.yml
Major Hayden 4aeb6f2b28 CI: Split image tests into separate tasks
Make it easier to see progress in Jenkins for image tests and keep their
logs separated for easier diagnosis of problems.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-14 00:32:34 +02:00

46 lines
1.6 KiB
YAML

---
- name: Setup test case prefix based on distro and release
set_fact:
test_case_prefix: >-
{%- if ansible_distribution == "Fedora" -%}
fedora_{{ ansible_distribution_version }}-{{ ansible_machine }}
{%- else -%}
rhel_{{ ansible_distribution_version }}-{{ ansible_machine }}
{%- endif -%}
- block:
- name: "Run image test case: {{ test_case_prefix }}-{{ test_case }}"
command: |
{{ image_test_executable }} -test.v \
-test.timeout {{image_test_timeout * 60}}s \
{{ image_test_case_path }}/{{ test_case_prefix }}-{{ test_case }}
args:
chdir: "{{ tests_working_directory }}"
register: test_cmd
- name: "Mark test case as passed: {{ test_case_prefix }}-{{ test_case }}"
set_fact:
passed_tests: "{{ passed_tests + [ test_case_prefix + '-' + test_case ] }}"
rescue:
- name: "Mark test case as failed: {{ test_case_prefix }}-{{ test_case }}"
set_fact:
failed_tests: "{{ failed_tests + [ test_case_prefix + '-' + test_case ] }}"
always:
- name: "Write log for test case: {{ test_case_prefix }}-{{ test_case }}"
copy:
dest: "{{ workspace }}/{{ test_case_prefix }}-{{ test_case }}.log"
content: |
Logs from test case: {{ test_case_prefix }}-{{ test_case }}
----------------------------------------------------------------------
stderr:
{{ test_cmd.stderr }}
----------------------------------------------------------------------
stdout:
{{ test_cmd.stdout }}