Jesse Pretorius (odyssey4me) ba51c4c7d1 Revert "Use tempest run for generating subunit results"
This reverts commit ea8ae41f6146d762bfe4b146a71dbda6740dcf08.

When using this patch, tempest seems to always have a return code
of 0, so it looks like the tests passed even when they did not.

Also, the 'always' section of the block was mistakenly removed.

Change-Id: Ia2433924ad830edb23b1b061b277344bbf477ab9
2018-12-13 17:49:33 +00:00

95 lines
3.1 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- block:
- name: Execute tempest tests
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
tempest run {% if tempest_run_concurrency is defined %}{% if tempest_run_concurrency | int > 0 %}--concurrency {{ tempest_run_concurrency | int }}{% else %}--serial{% endif %}{% endif %} --whitelist-file {{ tempest_test_whitelist_file_path }}{% if tempest_test_blacklist | length > 0 %} --blacklist-file {{ tempest_test_blacklist_file_path }}{% endif %}
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
register: tempest_tests_run
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
always:
- name: Generate raw subunit results
# Despite not using testrepository, we leave the output filename as
# testrepository.subunit as the OpenStack Health dashboard relies on
# subunit files with this particular name.
# NOTE(mattt): At present we're not placing this file in a valid location
# to be used by the OpenStack Health dashboard.
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
{{ stestr_executable }} last --subunit > {{ tempest_log_dir }}/testrepository.subunit
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
failed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
- name: Generate xml subunit results
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
subunit2junitxml {{ tempest_log_dir }}/testrepository.subunit > {{ tempest_log_dir }}/tempest_results.xml
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
failed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
- name: Generate html subunit results
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
subunit2html {{ tempest_log_dir }}/testrepository.subunit {{ tempest_log_dir }}/stestr_results.html
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
failed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
- name: Fail if tempest tests did not succeed
assert:
that:
- "tempest_tests_run.rc == 0"