Merge "Revert "Revert "Add consolidated role for processing subunit"""
This commit is contained in:
commit
c299ca8ef6
@ -1,4 +1,3 @@
|
|||||||
- hosts: all
|
- hosts: all
|
||||||
roles:
|
roles:
|
||||||
- fetch-testr-output
|
- fetch-subunit-output
|
||||||
- fetch-stestr-output
|
|
||||||
|
12
roles/fetch-subunit-output/README.rst
Normal file
12
roles/fetch-subunit-output/README.rst
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Collect subunit outputs
|
||||||
|
|
||||||
|
**Role Variables**
|
||||||
|
|
||||||
|
.. zuul:rolevar:: zuul_work_dir
|
||||||
|
:default: {{ zuul.project.src_dir }}
|
||||||
|
|
||||||
|
Directory to work in
|
||||||
|
|
||||||
|
.. zuul:rolevar:: tox_envlist
|
||||||
|
|
||||||
|
tox environment that was used to run the tests originally.
|
2
roles/fetch-subunit-output/defaults/main.yaml
Normal file
2
roles/fetch-subunit-output/defaults/main.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
48
roles/fetch-subunit-output/tasks/main.yaml
Normal file
48
roles/fetch-subunit-output/tasks/main.yaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
- name: Check for stestr directory
|
||||||
|
stat:
|
||||||
|
path: "{{ zuul_work_dir }}/.stestr"
|
||||||
|
register: stestr_stat
|
||||||
|
|
||||||
|
- name: Generate stestr subunit file
|
||||||
|
shell:
|
||||||
|
cmd: ".tox/{{ tox_envlist }}/bin/stestr last --subunit > ./testrepository.subunit"
|
||||||
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
when:
|
||||||
|
- tox_envlist is defined
|
||||||
|
- stestr_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Generate stestr subunit file
|
||||||
|
shell:
|
||||||
|
cmd: "stestr last --subunit > ./testrepository.subunit"
|
||||||
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
when:
|
||||||
|
- tox_envlist is not defined
|
||||||
|
- stestr_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Check for testr directory
|
||||||
|
stat:
|
||||||
|
path: "{{ zuul_work_dir }}/.testrepository"
|
||||||
|
register: testr_stat
|
||||||
|
when: not stestr_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Generate testrepository.subunit file
|
||||||
|
shell:
|
||||||
|
cmd: ".tox/{{ tox_envlist }}/bin/testr last --subunit > ./testrepository.subunit"
|
||||||
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
when:
|
||||||
|
- tox_envlist is defined
|
||||||
|
- not stestr_stat.stat.exists
|
||||||
|
- testr_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Generate testrepository.subunit file
|
||||||
|
shell:
|
||||||
|
cmd: "testr last --subunit > ./testrepository.subunit"
|
||||||
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
when:
|
||||||
|
- tox_envlist is not defined
|
||||||
|
- not stestr_stat.stat.exists
|
||||||
|
- testr_stat.stat.exists
|
||||||
|
|
||||||
|
- name: Process and fetch subunit results
|
||||||
|
include: process.yaml
|
||||||
|
when: stestr_stat.stat.exists or testr_stat.stat.exists
|
22
roles/fetch-subunit-output/tasks/process.yaml
Normal file
22
roles/fetch-subunit-output/tasks/process.yaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
- name: Generate testr_results.html file
|
||||||
|
# TODO(pabelanger): We cannot depend on /usr/os-testr-env here!!!
|
||||||
|
command: "/usr/os-testr-env/bin/subunit2html ./testrepository.subunit testr_results.html"
|
||||||
|
args:
|
||||||
|
chdir: "{{ zuul_work_dir }}"
|
||||||
|
|
||||||
|
- name: Compress testrepository files
|
||||||
|
archive:
|
||||||
|
path: "{{ zuul_work_dir }}/{{ item }}"
|
||||||
|
with_items:
|
||||||
|
- testrepository.subunit
|
||||||
|
- testr_results.html
|
||||||
|
|
||||||
|
- name: Collect test-results
|
||||||
|
synchronize:
|
||||||
|
dest: "{{ zuul.executor.log_root }}"
|
||||||
|
mode: pull
|
||||||
|
src: "{{ zuul_work_dir }}/{{ item }}"
|
||||||
|
verify_host: true
|
||||||
|
with_items:
|
||||||
|
- "*testr_results.html.gz"
|
||||||
|
- "*testrepository.subunit.gz"
|
Loading…
Reference in New Issue
Block a user