Monty Taylor ebdcf57fb0
Add consolidated role for processing subunit
We don't need two roles for testr and stestr. The roles have logic to
check to see if .testrepository or .stestr dirs exist, and the logic
after the subunit extraction is the same. Combine them into a single
role which should do the right thing.

Also, document it.

Change-Id: I833320cf9a932d8e119645eb798ce0c93d854321
2017-12-20 08:33:42 -06:00

49 lines
1.3 KiB
YAML

- 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 }}/.stestr"
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