Files
openstack-ansible-os_tempest/tasks/tempest_run.yml
Matt Thompson f8404f5eeb Switch from testrepository to stestr
This commit replaces the call to testr with stestr, and updates the
output files accordingly. This is necessary because tempest has moved
away from testrepository [1], which is resulting in empty files being
created.

Lastly, we update the functional tests to ensure the subunit results
files exist and are not empty.

[1] https://review.openstack.org/#/c/504345/

Change-Id: I2496fccff1f51c586e999538232a4bcf0addbee5
2018-03-27 18:02:18 +00:00

79 lines
2.7 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: |
. {{ tempest_venv_bin }}/activate
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 }}
args:
chdir: "{{ tempest_venv_bin | dirname }}/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: |
. {{ tempest_venv_bin }}/activate
stestr last --subunit > {{ tempest_log_dir }}/testrepository.subunit
args:
chdir: "{{ tempest_venv_bin | dirname }}/workspace"
executable: /bin/bash
changed_when: false
failed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
- name: Generate xml subunit results
shell: |
. {{ tempest_venv_bin }}/activate
subunit2junitxml {{ tempest_log_dir }}/testrepository.subunit > {{ tempest_log_dir }}/tempest_results.xml
args:
chdir: "{{ tempest_venv_bin | dirname }}/workspace"
executable: /bin/bash
changed_when: false
failed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
- name: Generate html subunit results
shell: |
. {{ tempest_venv_bin }}/activate
subunit2html {{ tempest_log_dir }}/testrepository.subunit {{ tempest_log_dir }}/stestr_results.html
args:
chdir: "{{ tempest_venv_bin | dirname }}/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"