diff --git a/doc/source/contributing/developer_guide.rst b/doc/source/contributing/developer_guide.rst index bf9f32d44..1934ac866 100644 --- a/doc/source/contributing/developer_guide.rst +++ b/doc/source/contributing/developer_guide.rst @@ -666,78 +666,8 @@ Local testing of new roles Local testing of new roles can be done in two ways: -* with `tox-ansible `_, -* or via the script `scripts/run-local-test`. - -Running molecule tests with `tox-ansible`_ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -`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/ diff --git a/tox.ini b/tox.ini index e3ef9fb5b..708d5f3df 100644 --- a/tox.ini +++ b/tox.ini @@ -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 diff --git a/zuul.d/layout.yaml b/zuul.d/layout.yaml index 8252a1e7f..ec0397926 100644 --- a/zuul.d/layout.yaml +++ b/zuul.d/layout.yaml @@ -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: