Files
openstack-ansible-os_tempest/tasks/tempest_run.yml
Chandan Kumar (raukadah) 0c49b5c308 Append the tempest run command output in file
In CI, when we run full tempest api and scenario tests, it takes
time and in most of the time at Execute tempest tasks hits
Timeout and no ara report got generated. So we have no idea
what tests ate the time.

Logging the tempest result in a file will give more info
on what happened with the tests.

Change-Id: Ibba761551e6bc14c127d9461de2a72e9f0fcb715
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
2019-10-15 17:03:27 +05:30

146 lines
4.4 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 %}
--concurrency {{ tempest_run_concurrency }} \
{% else %}
--serial \
{% endif %}
{% if tempest_test_blacklist | length > 0 %}
--blacklist-file {{ tempest_test_blacklist_file_path }} \
{% endif %}
--whitelist-file {{ tempest_test_whitelist_file_path }} > {{ tempest_log_dir }}/tempest_run.log
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: Generate test-list file
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
tempest run \
--whitelist-file {{ tempest_test_whitelist_file_path }} \
{% if tempest_test_blacklist | length > 0 %}
--blacklist-file {{ tempest_test_blacklist_file_path }} \
{% endif %}
--list-tests &> {{ tempest_log_dir }}/test_list.txt
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
failed_when: false
- block:
# Copy module doesn't copy recursively with remote_src set to true
- name: Copy stackviz-html to home directory
shell: |
cp -r {{ stackviz_venv_bin | dirname }}/share/stackviz-html {{ tempest_log_dir }}/stackviz
args:
executable: /bin/bash
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
- name: Collecting data from tempest run
shell: |
. {{ stackviz_venv_bin }}/activate
stackviz-export -f {{ tempest_log_dir }}/testrepository.subunit --env {{ tempest_log_dir }}/stackviz/data
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
when: tempest_run_stackviz | bool
- name: Fail if tempest tests did not succeed
assert:
that:
- "tempest_tests_run.rc == 0"