feat(removal): tox-ansible support

This patch removes the support of tox-ansible from
tripleo-validations. Due to several issues with pip dependencies
management and our requirements files, the installation of this latter
doesn't work.

This patch also removes the `tripleo-linters` anchor and nodeset line
for the `openstack-tox-linters` check job as they are not used or useful
here.

JIRA: #VALFRWK702

Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Change-Id: I02d70e9eaf112d9d9137a020c8b236c150a12149
This commit is contained in:
Gael Chamoulaud (Strider) 2022-01-06 09:53:29 +01:00
parent d498462d7b
commit 01ae2b4ea2
No known key found for this signature in database
GPG Key ID: 4119D0305C651D66
3 changed files with 17 additions and 94 deletions

View File

@ -666,78 +666,8 @@ Local testing of new roles
Local testing of new roles can be done in two ways:
* with `tox-ansible <https://github.com/ansible-community/tox-ansible>`_,
* or via the script `scripts/run-local-test`.
Running molecule tests with `tox-ansible`_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
`Tox-ansible <https://github.com/ansible-community/tox-ansible>`_ is a plugin
for `tox`_ which auto-generates tox environments for running quality assurance
tools like `ansible-test`_ or `molecule`_.
Tox-ansible will generate as many tox environment(s) as molecule scenarios in
your role. This way you will be able to run locally the desired molecule scenario.
To list all the defined environments generated by tox-ansible:
.. code-block:: console
$ tox -va
default environments:
ceph -> Auto-generated for: cd roles/ceph && molecule test -s default
ceph-ceph-ansible-installed -> Auto-generated for: cd roles/ceph && molecule test -s ceph-ansible-installed
check_for_dangling_images -> Auto-generated for: cd roles/check_for_dangling_images && molecule test -s default
check_kernel_version -> Auto-generated for: cd roles/check_kernel_version && molecule test -s default
check_network_gateway -> Auto-generated for: cd roles/check_network_gateway && molecule test -s default
check_rhsm_version -> Auto-generated for: cd roles/check_rhsm_version && molecule test -s default
check_rhsm_version-rhsm_mismatch -> Auto-generated for: cd roles/check_rhsm_version && molecule test -s rhsm_mismatch
check_uc_hostname -> Auto-generated for: cd roles/check_uc_hostname && molecule test -s default
check_undercloud_conf -> Auto-generated for: cd roles/check_undercloud_conf && molecule test -s default
check_undercloud_conf-config_OK -> Auto-generated for: cd roles/check_undercloud_conf && molecule test -s config_OK
check_undercloud_conf-deprecated_drivers -> Auto-generated for: cd roles/check_undercloud_conf && molecule test -s deprecated_drivers
check_undercloud_conf-deprecated_params -> Auto-generated for: cd roles/check_undercloud_conf && molecule test -s deprecated_params
check_undercloud_conf-required_missing -> Auto-generated for: cd roles/check_undercloud_conf && molecule test -s required_missing
collect_flavors_and_verify_profiles -> Auto-generated for: cd roles/collect_flavors_and_verify_profiles && molecule test -s default
container_status -> Auto-generated for: cd roles/container_status && molecule test -s default
controller_token -> Auto-generated for: cd roles/controller_token && molecule test -s default
controller_ulimits -> Auto-generated for: cd roles/controller_ulimits && molecule test -s default
...
additional environments:
bindep -> [no description]
debug -> [no description]
pep8 -> [no description]
ansible-lint -> [no description]
yamllint -> [no description]
bashate -> [no description]
whitespace -> [no description]
shebangs -> [no description]
releasenotes -> [no description]
cover -> [no description]
To execute one molecule scenario with tox, run the following command:
.. code-block:: console
$ tox -e check_undercloud_conf
If you want to run several molecule scenarios at once, you will have to
explicitly list all of them and separating them with commas:
.. code-block:: console
$ tox -e check_undercloud_conf,check_undercloud_conf-config_OK,check_undercloud_conf-deprecated_drivers
.. warning::
Running multiple molecule scenarios at once could be time-consuming due to
the fact that each Molecule execution will create a new container instance
and will destroy it at the end of each scenario.
.. _tox: https://tox.readthedocs.io/en/latest/index.html
.. _ansible-test: https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_testing.html#testing-collections
.. _molecule: https://github.com/ansible-community/molecule
* Via the script `scripts/run-local-test`,
* or manually by following the procedure described below.
Running molecule tests with the script run-local-test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -771,20 +701,20 @@ a role with tags.
Running molecule tests manually
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Role based testing with molecule can be executed directly from within
Role based testing with `molecule`_ can be executed directly from within
the role directory.
.. note::
All tests require Podman for container based testing. If Podman
is not available on the local workstation it will need to be
installed prior to executing most molecule based tests.
All tests require `Podman`_ for container based testing. If `Podman`_ is not
available on the local workstation it will need to be installed prior to
executing most molecule based tests.
.. note::
The script `bindep-install`, in the **scripts** path, is
available and will install all system dependencies.
The script `bindep-install`, in the **scripts** path, is available and will
install all system dependencies.
.. note::
@ -798,7 +728,7 @@ the role directory.
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
It is an OpenStack Zuul requirement for detecting if we are on a CI node. Of
course, when running your molecule test on your workstation, it is going
course, when running your `molecule`_ test on your workstation, it is going
to fail because you don't have the empty `mirror_info.sh` script in the
`/etc/ci/` directory. You can workaround this by creating it in your
workstation or removing the volume key in the global configuration file for
@ -811,7 +741,7 @@ the role directory.
Before running basic molecule tests, it is recommended to install all
Before running basic `molecule`_ tests, it is recommended to install all
of the python dependencies in a virtual environment.
.. code-block:: console
@ -827,7 +757,7 @@ of the python dependencies in a virtual environment.
(test-python) $ ansible-galaxy install -fr ansible-collections-requirements.txt
Now, it is important to install validations-common and tripleo-ansible as
Now, it is important to install `validations-common` and `tripleo-ansible` as
dependencies.
.. note::
@ -847,7 +777,7 @@ dependencies.
$ for REPO in validations-common tripleo-ansible; do git clone https://opendev.org/openstack/${REPO} roles/roles.galaxy/${REPO}; done
To run a basic molecule test, simply source the `ansible-test-env.rc`
To run a basic `molecule`_ test, simply source the `ansible-test-env.rc`
file from the project root, and then execute the following commands.
.. code-block:: console
@ -868,10 +798,13 @@ the `--scenario-name` flag with the name of the desired scenario.
(test-python) $ molecule test --scenario-name ${EXTRA_SCENARIO_NAME}
When debugging molecule tests its sometimes useful to use the
When debugging `molecule`_ tests its sometimes useful to use the
`--debug` flag. This flag will provide extra verbose output about
test being executed and running the environment.
.. code-block:: console
(test-python) $ molecule --debug test
.. _molecule: https://github.com/ansible-community/molecule
.. _podman: https://podman.io/

View File

@ -3,8 +3,6 @@ minversion = 3.2.0
envlist = linters,docs,py
skipsdist = True
ignore_basepython_conflict = True
requires =
tox-ansible >= 1.4.0
[testenv]
basepython = python3
@ -89,10 +87,3 @@ commands=
# Settings for doc8:
extensions = .rst
ignore = D001
[ansible]
description = Used as base for all tox-ansible environments
ignore_path = _skeleton_role_
scenario_format = $parent-$nondefault_name
molecule_opts =
--debug

View File

@ -6,8 +6,7 @@
- check-requirements
check:
jobs:
- openstack-tox-linters: &tripleo-linters
nodeset: centos-8-stream
- openstack-tox-linters
- openstack-tox-py36
- openstack-tox-py39
- tripleo-ci-centos-8-content-provider: