debian-forge-composer/schutzbot/test_runner_image.yml
Major Hayden fcd351f085 ↔ Parallel testing on internal Jenkins
Attempt osbuild-composer testing on the internal Jenkins deployment with
nodes that are destroyed after each use. The internal Jenkins looks for
a Jenkinsfile inside the `schutzbot` directory.

Let's not remove the `jenkins` directory (used by jenkins.osbuild.org)
yet until we know the internal Jenkins is stable and performs well.

Signed-off-by: Major Hayden <major@redhat.com>
2020-05-12 07:48:25 -05:00

64 lines
2 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 -%}
- name: Show which tests will be run
debug:
msg: |
Running the following image test cases:
{% for test_case in osbuild_composer_image_test_cases %}
- {{ test_case | splitext | first }}
{% endfor %}
- block:
# NOTE(mhayden): The fancy jinja2 here ensures that the last test case
# in the list does not have a backslash added. That would make the shell
# upset and nobody likes it when that happens.
- name: "Run image tests"
command: |
{{ image_test_executable }} -test.v \
{% for test_case in osbuild_composer_image_test_cases %}
{% if loop.last %}
{{ image_test_case_path }}/{{ test_case_prefix }}-{{ test_case }}
{% else %}
{{ image_test_case_path }}/{{ test_case_prefix }}-{{ test_case }} \
{% endif %}
{% endfor %}
args:
chdir: "{{ tests_working_directory }}"
register: async_test
async: "{{ image_test_timeout * 60 }}"
poll: "{{ polling_interval }}"
- name: "Mark image tests as passed"
set_fact:
passed_tests: "{{ passed_tests + ['image_tests'] }}"
rescue:
- name: "Mark image tests as failed"
set_fact:
failed_tests: "{{ failed_tests + ['image_tests'] }}"
always:
- name: "Write log for image tests"
copy:
dest: "{{ workspace }}/image_test.log"
content: |
Logs from image test
----------------------------------------------------------------------
stderr:
{{ async_test.stderr }}
----------------------------------------------------------------------
stdout:
{{ async_test.stdout }}