Fix linters and metadata

With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: Ifcb6ebfa971e324e447509e50cc7294bddd6a4a0
This commit is contained in:
Dmitriy Rabotyagov 2023-07-14 20:37:15 +02:00
parent 6081d1daac
commit 687dcb30bf
12 changed files with 247 additions and 212 deletions

View File

@ -33,7 +33,11 @@ tempest_package_state: "latest"
# for the service setup. The host must already have
# clouds.yaml properly configured.
tempest_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
tempest_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((tempest_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
tempest_service_setup_host_python_interpreter: >-
{{
openstack_service_setup_host_python_interpreter | default(
(tempest_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable']))
}}
# Toggle whether tempest actually executes
tempest_run: no
@ -41,7 +45,7 @@ tempest_run: no
tempest_cleanup: no
# if tempest_cleanup_dry_run is set to true, tempest cleanup will log all found
# leftover resources to a dry_run.json file, none resources will be deleted
#tempest_cleanup_dry_run: no
# tempest_cleanup_dry_run: no
# Credential Provider Mechanisms
# If tempest_test_accounts is not an empty string, then use_dynamic_credentials will be turned off
@ -63,7 +67,7 @@ tempest_flavors_create: true
tempest_projects_create: "{{ tempest_public_net_create or tempest_private_net_create or tempest_router_create }}"
# Define 0 (serial) or more to use a non default concurrency
#tempest_run_concurrency:
# tempest_run_concurrency:
# Define the worker file to be used by tempest
# This worker file is parsed to stestr to manually schedule tempest tests
@ -71,9 +75,10 @@ tempest_projects_create: "{{ tempest_public_net_create or tempest_private_net_cr
# We comment `tempest_git_repo` so that we do not attempt to build the wheel from this repo/branch.
# Instead, we want tempest to get built from the stable release defined in global requirements.
#tempest_git_repo: https://opendev.org/openstack/tempest
# tempest_git_repo: https://opendev.org/openstack/tempest
tempest_git_install_branch: master
tempest_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}"
tempest_upper_constraints_url: >-
{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}
tempest_git_constraints:
- "--constraint {{ tempest_upper_constraints_url }}"
@ -258,15 +263,22 @@ tempest_service_available_manila: "{{ groups['manila_all'] is defined and groups
tempest_service_available_mistral: "{{ groups['mistral_all'] is defined and groups['mistral_all'] | length > 0 }}"
tempest_service_available_murano: "{{ groups['murano_all'] is defined and groups['murano_all'] | length > 0 }}"
tempest_service_available_neutron: "{{ groups['neutron_all'] is defined and groups['neutron_all'] | length > 0 }}"
tempest_service_available_neutron_bgpvpn: "{{ (groups['neutron_all'] is defined) and (groups['neutron_all'] | length > 0) and ('bgpvpn' in neutron_plugin_base | default([])) }}"
tempest_service_available_neutron_vpnaas: "{{ (groups['neutron_all'] is defined) and (groups['neutron_all'] | length > 0) and ('vpnaas' in neutron_plugin_base | default([])) }}"
tempest_service_available_neutron_bgpvpn: >-
{{ (groups['neutron_all'] is defined) and (groups['neutron_all'] | length > 0) and ('bgpvpn' in neutron_plugin_base | default([])) }}
tempest_service_available_neutron_vpnaas: >-
{{ (groups['neutron_all'] is defined) and (groups['neutron_all'] | length > 0) and ('vpnaas' in neutron_plugin_base | default([])) }}
tempest_service_available_nova: "{{ groups['nova_all'] is defined and groups['nova_all'] | length > 0 }}"
tempest_service_available_novajoin: False
tempest_service_available_octavia: "{{ groups['octavia_all'] is defined and groups['octavia_all'] | length > 0 }}"
tempest_service_available_panko: "{{ groups['panko_all'] is defined and groups['panko_all'] | length > 0 }}"
tempest_service_available_sahara: "{{ groups['sahara_all'] is defined and groups['sahara_all'] | length > 0 }}"
tempest_service_available_senlin: "{{ groups['senlin_all'] is defined and groups['senlin_all'] | length > 0 }}"
tempest_service_available_swift: "{{ (groups['swift_all'] is defined and groups['swift_all'] | length > 0) or (groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or (ceph_rgws is defined and ceph_rgws | length > 0) }}"
tempest_service_available_swift: >-
{{
(groups['swift_all'] is defined and groups['swift_all'] | length > 0) or
(groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or
(ceph_rgws is defined and ceph_rgws | length > 0)
}}
tempest_service_available_trove: "{{ groups['trove_all'] is defined and groups['trove_all'] | length > 0 }}"
tempest_service_available_whitebox: False
tempest_service_available_whitebox_neutron: False
@ -277,7 +289,11 @@ tempest_service_available_zun: "{{ groups['zun_all'] is defined and groups['zun_
tempest_keystone_interface_insecure: "{{ (keystone_service_internaluri_insecure | default(false)) | bool }}"
tempest_pip_packages:
- "{{ (tempest_git_repo is defined) | ternary('git+' ~ (tempest_git_repo | default('https://opendev.org/openstack/tempest.git')) ~ '@' ~ tempest_git_install_branch ~ '#egg=tempest', 'tempest') }}"
- "{{
(tempest_git_repo is defined) | ternary(
'git+' ~ (tempest_git_repo | default('https://opendev.org/openstack/tempest.git')) ~ '@' ~ tempest_git_install_branch ~ '#egg=tempest',
'tempest')
}}"
- cmd2
- ddt
- junitxml
@ -362,7 +378,13 @@ tempest_tempestconf_git_install_branch: master
tempest_tempestconf_git_constraints:
- "--constraint {{ tempest_upper_constraints_url }}"
tempest_tempestconf_pip_packages:
- "{{ (tempest_tempestconf_git_repo is defined) | ternary('git+' ~ (tempest_tempestconf_git_repo | default('https://opendev.org/openinfra/python-tempestconf')) ~ '@' ~ tempest_tempestconf_git_install_branch ~ '#egg=python_tempestconf', 'python_tempestconf') }}"
- "{{
(tempest_tempestconf_git_repo is defined) | ternary(
'git+' ~ (tempest_tempestconf_git_repo | default(
'https://opendev.org/openinfra/python-tempestconf')
) ~ '@' ~ tempest_tempestconf_git_install_branch ~ '#egg=python_tempestconf',
'python_tempestconf')
}}"
tempest_tempestconf_profile:
debug: true
create: true

View File

@ -15,25 +15,23 @@
galaxy_info:
role_name: os_tempest
namespace: openstack
author: rcbops
description: Installation and setup of tempest
company: Rackspace
license: Apache2
min_ansible_version: 2.10
min_ansible_version: "2.10"
platforms:
- name: Debian
versions:
- buster
- bullseye
- name: Ubuntu
versions:
- bionic
- focal
- jammy
- name: EL
versions:
- 8
- name: CentOS
versions:
- 8
- "9"
galaxy_tags:
- cloud
- python

View File

@ -30,7 +30,7 @@
- name: Set tempest service specific variables
set_fact:
tempest_service_available_{{ item }}: true
tempest_service_available_{{ item }}: true # noqa: var-naming[no-jinja]
with_items: "{{ tempest_services }}"
when: tempest_services | length > 0
@ -49,32 +49,38 @@
tags:
- always
- import_tasks: tempest_install.yml
- name: Importing tempest_install tasks
import_tasks: tempest_install.yml
tags:
- tempest-install
- import_tasks: tempest_resources.yml
- name: Importing tempest_resources tasks
import_tasks: tempest_resources.yml
when: tempest_default_role_resources | bool
run_once: yes
tags:
- tempest-config
- tempest-run
- import_tasks: tempest_post_install.yml
- name: Importing tempest_post_install tasks
import_tasks: tempest_post_install.yml
tags:
- tempest-config
- name: Flush handlers
meta: flush_handlers
- import_tasks: tempest_cleanup_init.yml
- name: Importing tempest_cleanup_init tasks
import_tasks: tempest_cleanup_init.yml
when: tempest_cleanup | bool
- import_tasks: tempest_run.yml
- name: Importing tempest_run tasks
import_tasks: tempest_run.yml
when: tempest_run | bool
tags:
- tempest-config
- tempest-run
- import_tasks: tempest_cleanup.yml
- name: Importing tempest_cleanup tasks
import_tasks: tempest_cleanup.yml
when: tempest_cleanup | bool

View File

@ -13,21 +13,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- block:
- name: Cleanup leftover resources
shell: >
set -e;
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate;
fi;
tempest cleanup
{% if tempest_cleanup_dry_run | bool %}
--dry-run
{% endif %}
{% if debug | bool %}
--debug
{% endif %}
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
- name: Cleanup leftover resources
shell: >
set -e;
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate;
fi;
tempest cleanup
{% if tempest_cleanup_dry_run | bool %}
--dry-run
{% endif %}
{% if debug | bool %}
--debug
{% endif %}
changed_when: false
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash

View File

@ -13,19 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- block:
- name: Generate saved_state.json for tempest cleanup
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
tempest cleanup \
{% if debug | bool %}
--debug \
{% endif %}
--init-saved-state
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
- name: Generate saved_state.json for tempest cleanup
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
tempest cleanup \
{% if debug | bool %}
--debug \
{% endif %}
--init-saved-state
changed_when: false
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash

View File

@ -39,6 +39,6 @@
vars:
venv_install_destination_path: "{{ stackviz_venv_bin | dirname }}"
venv_pip_install_args: "{{ stackviz_pip_install_args }}"
venv_pip_packages: "{{ [ stackviz_tarball ] }}"
venv_pip_packages: "{{ [stackviz_tarball] }}"
venv_wheel_build_enable: no
when: tempest_run_stackviz | bool

View File

@ -36,7 +36,8 @@
name: "python_venv_build"
vars:
venv_python_executable: "{{ tempest_venv_python_executable }}"
venv_build_constraints: "{{ (tempest_git_repo is defined) | ternary( _u_c_contents.content.split('\n') | reject('match', '^tempest=') | list, tempest_git_constraints) }}"
venv_build_constraints: >-
{{ (tempest_git_repo is defined) | ternary(_u_c_contents.content.split('\n') | reject('match', '^tempest=') | list, tempest_git_constraints) }}
venv_install_destination_path: "{{ tempest_venv_bin | dirname }}"
venv_build_distro_package_list: "{{ tempest_devel_distro_packages }}"
venv_pip_install_args: "{{ tempest_pip_install_args }}"

View File

@ -20,7 +20,7 @@
state: directory
owner: "{{ item.owner | default(omit) }}"
group: "{{ item.group | default(omit) }}"
mode: "{{ item.mode|default('0755') }}"
mode: "{{ item.mode | default('0755') }}"
with_items:
- path: "{{ tempest_log_dir | realpath }}"
owner: root
@ -83,8 +83,8 @@
- not tempest_use_tempestconf | bool
- copy_tempest_config is changed
tags:
# don't trigger ANSIBLE0016
- skip_ansible_lint
# don't trigger ANSIBLE0016
- skip_ansible_lint
- name: Initialise tempest workspace
shell: |
@ -122,7 +122,8 @@
# don't trigger ANSIBLE0013
- skip_ansible_lint
- import_tasks: tempestconf.yml
- name: Importing tempestconf tasks
import_tasks: tempestconf.yml
when: tempest_use_tempestconf | bool
tags:
- tempest-config
@ -135,6 +136,7 @@
. {{ tempest_venv_bin }}/activate
fi
tempest list-plugins
changed_when: false
args:
executable: /bin/bash
when: "debug | bool"

View File

@ -95,6 +95,7 @@
file:
path: "{{ tempest_image_dir }}"
state: directory
mode: "0755"
when:
- tempest_service_available_glance | bool
- tempest_images_create | bool
@ -174,7 +175,7 @@
- name: Store demo tenant id
set_fact:
keystone_demo_tenant_id: "{{ (add_project.results | json_query('[*].project.id'))[0] }}"
keystone_demo_tenant_id: "{{ (add_project.results | json_query('[*].project.id'))[0] }}" # noqa: jinja[invalid]
when:
- tempest_projects_create | bool
@ -320,6 +321,7 @@
set -e
ping -c2 "{{ router_ip }}"
register: _ping_router
changed_when: false
until: _ping_router is success
retries: 5
delay: 10

View File

@ -13,154 +13,155 @@
# 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_worker_file_path is defined %}
--worker-file {{ tempest_test_worker_file_path }} \
{% endif %}
{% if tempest_test_excludelist | length > 0 %}
--exclude-list {{ tempest_test_excludelist_file_path }} \
{% endif %}
--include-list {{ tempest_test_includelist_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
- name: Executing tempest and collect results
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_worker_file_path is defined %}
--worker-file {{ tempest_test_worker_file_path }} \
{% endif %}
{% if tempest_test_excludelist | length > 0 %}
--exclude-list {{ tempest_test_excludelist_file_path }} \
{% endif %}
--include-list {{ tempest_test_includelist_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 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 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 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 \
--include-list {{ tempest_test_includelist_file_path }} \
{% if tempest_test_excludelist | length > 0 %}
--exclude-list {{ tempest_test_excludelist_file_path }} \
{% endif %}
--list-tests &> {{ tempest_log_dir }}/test_list.txt
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
failed_when: false
- name: Generate test-list file
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
tempest run \
--include-list {{ tempest_test_includelist_file_path }} \
{% if tempest_test_excludelist | length > 0 %}
--exclude-list {{ tempest_test_excludelist_file_path }} \
{% endif %}
--list-tests &> {{ tempest_log_dir }}/test_list.txt
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
changed_when: false
failed_when: false
# 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
when: tempest_run_stackviz | bool
# 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
when: tempest_run_stackviz | bool
- 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: 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: Create tempest failing tests file
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
{{ stestr_executable }} failing --list > {{ tempest_log_dir }}/failing_tests.log
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
failed_when: false
changed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
when: tempest_tests_run.rc != 0
- name: Create tempest failing tests file
shell: |
set -e
if [ -d {{ tempest_venv_bin }} ];
then
. {{ tempest_venv_bin }}/activate
fi
{{ stestr_executable }} failing --list > {{ tempest_log_dir }}/failing_tests.log
args:
chdir: "{{ tempest_workspace }}"
executable: /bin/bash
failed_when: false
changed_when: false
tags:
# don't trigger ANSIBLE0013
- skip_ansible_lint
when: tempest_tests_run.rc != 0
- name: Fail if tempest tests did not succeed
assert:
that:
- "tempest_tests_run.rc == 0"
- name: Fail if tempest tests did not succeed
assert:
that:
- "tempest_tests_run.rc == 0"

View File

@ -48,3 +48,4 @@
src: "{{ tempest_workspace }}/etc/tempest.conf"
dest: "/etc/tempest/tempest.conf"
remote_src: yes
mode: "0644"

View File

@ -34,14 +34,10 @@ tempest_images_map:
checksum: "sha256:db9420c481c11dee17860aa46fb1a3efa05fa4fb152726d6344e24da03cb0ccf"
format: "qcow2"
name: "cirros"
# properties:
#hw_firmware_type: uefi
- url: "https://download.cirros-cloud.net/0.6.1/cirros-0.6.1-aarch64-disk.img"
checksum: "sha256:db9420c481c11dee17860aa46fb1a3efa05fa4fb152726d6344e24da03cb0ccf"
format: "qcow2"
name: "cirros"
#properties:
#hw_firmware_type: uefi
# Each tempest plugin could take the following arguments:
# - name:
@ -118,7 +114,13 @@ _tempest_plugins:
- name: telemetry-tempest-plugin
repo: "{{ tempest_plugin_telemetry_git_repo }}"
branch: "{{ tempest_plugin_telemetry_git_install_branch }}"
install: "{{ (tempest_service_available_aodh | bool) or (tempest_service_available_ceilometer | bool) or (tempest_service_available_gnocchi | bool) or (tempest_service_available_panko | bool) }}"
install: >-
{{
(tempest_service_available_aodh | bool) or
(tempest_service_available_ceilometer | bool) or
(tempest_service_available_gnocchi | bool) or
(tempest_service_available_panko | bool)
}}
- name: trove-tempest-plugin
repo: "{{ tempest_plugin_trove_git_repo }}"
branch: "{{ tempest_plugin_trove_git_install_branch }}"