Use golang's `test.timeout` to set the timeout instead of using ansible's `async` property. The latter doesn't respect `register` when running into a timeout, which means there are no logs in that case.
34 lines
922 B
YAML
34 lines
922 B
YAML
---
|
|
|
|
- block:
|
|
|
|
- name: "Run {{ test.name }} test"
|
|
command: "{{ tests_path }}/{{ test.name }} -test.v -test.timeout {{ test.timeout * 60 }}s"
|
|
args:
|
|
chdir: "{{ tests_working_directory }}"
|
|
register: test_cmd
|
|
|
|
- name: "Mark {{ test.name }} as passed"
|
|
set_fact:
|
|
passed_tests: "{{ passed_tests + [test.name] }}"
|
|
|
|
rescue:
|
|
|
|
- name: "Mark {{ test.name }} as failed"
|
|
set_fact:
|
|
failed_tests: "{{ failed_tests + [test.name] }}"
|
|
|
|
always:
|
|
|
|
- name: "Write log for {{ test.name }}"
|
|
copy:
|
|
dest: "{{ workspace }}/{{ test.name }}.log"
|
|
content: |
|
|
Logs from {{ test.name }}
|
|
----------------------------------------------------------------------
|
|
stderr:
|
|
{{ test_cmd.stderr }}
|
|
----------------------------------------------------------------------
|
|
stdout:
|
|
{{ test_cmd.stdout }}
|
|
|