Fix tempest html generation file

In the latest version of tempest, the testr was replaced by
stestr, and so, the path where these results were stored changed
as well from .testrepository to .stestr. This patch verify which
directory was generated, and execute the subunit2html in the
proper directory.

Change-Id: Ic5a04781f830597a2c5fe9516a704ff5a9b5ff24
Closes-Bug: #1729403
This commit is contained in:
Arx Cruz 2017-11-06 11:26:55 +01:00
parent d1cd3cd9e4
commit 3dab05c257
2 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,21 @@
---
- name: Check for .stestr directory
stat:
path: "{{ working_dir }}/tempest/.stestr"
register: testr_dir
- name: Define testr facts
set_fact:
testr_command: testr
testr_dir: .testrepository
when: not testr_dir.stat.exists
- name: Define stestr facts
set_fact:
testr_command: stestr
testr_dir: .stestr
when: testr_dir.stat.exists
- name: Cloning stackviz from openstack
git:
repo: git://git.openstack.org/openstack/stackviz
@ -35,7 +52,7 @@
- name: Collecting data from tempest
shell: >
{% if tempest_format == 'venv' %}source {{ working_dir }}/tempest_git/.venv/bin/activate; {% endif %}
testr last --subunit | subunit-1to2 | stackviz-export {{ tempest_dstat_opt | default('') }} --env --stdin {{ working_dir }}/stackviz_static/data
{{ testr_command }} last --subunit | subunit-1to2 | stackviz-export {{ tempest_dstat_opt | default('') }} --env --stdin {{ working_dir }}/stackviz_static/data
args:
chdir: "{{ working_dir }}/tempest"

View File

@ -4,21 +4,21 @@
- name: Generate testrepository.subunit results file
shell: >
{% if tempest_format == 'venv' %}source {{ working_dir }}/tempest_git/.venv/bin/activate; {% endif %}
testr last --subunit | subunit-1to2 > {{ working_dir }}/tempest/testrepository.subunit
{{ testr_command }} last --subunit | subunit-1to2 > {{ working_dir }}/tempest/testrepository.subunit
args:
chdir: "{{ working_dir }}/tempest"
- name: Generate HTML results file
shell: |
{% if tempest_format == 'venv' %}source {{ working_dir }}/tempest_git/.venv/bin/activate; {% endif %}
subunit2html $(find {{ working_dir }}/tempest/.testrepository -name [0-9] \
subunit2html $(find {{ working_dir }}/tempest/{{ testr_dir }} -name [0-9] \
| head -1) {{ working_dir }}/tempest/tempest.html \
2>&1 >> {{ tempest_log_file }}
- name: Generate XML results file
shell: |
{% if tempest_format == 'venv' %}source {{ working_dir }}/tempest_git/.venv/bin/activate; {% endif %}
subunit2junitxml $(find {{ working_dir }}/tempest/.testrepository -name [0-9] \
subunit2junitxml $(find {{ working_dir }}/tempest/{{ testr_dir }} -name [0-9] \
| head -1) {{ working_dir }}/tempest/tempest.xml \
2>&1 >> {{ tempest_log_file }}