tripleo-ansible/tox.ini
Jose Luis Franco Arza dd2fc8a73b Add back testing for tripleo-ansible modules.
[0] enabled the execution of molecule tests to cover the tripleo-ansible
added modules. However, the job was removed due to the movement to
collections.

As currently, none of the molecule tests under ansible_plugins/tests are
being triggered by the CI any changes into the corresponding modules
might break their functionality and pass unnoticed.

This patch enables back the tripleo-ansible-centos-8-molecule-tripleo-modules
test which will get triggered when some of the corresponding modules
get modified.

[0]: 2d42082737
Change-Id: Id6f89dfa7075e59f17fe847e3d14024aaa287933
2021-10-14 16:35:59 +02:00

119 lines
4.2 KiB
INI

[tox]
minversion = 3.18.0
envlist = docs,linters
skipsdist = True
[testenv]
usedevelop = True
install_command = python3 -m pip install {opts} {packages}
passenv = *
setenv =
ANSIBLE_ACTION_PLUGINS={toxinidir}/tripleo_ansible/roles.galaxy/config_template/action:{toxinidir}/tripleo_ansible/ansible_plugins/action
ANSIBLE_CALLBACK_PLUGINS={toxinidir}/tripleo_ansible/ansible_plugins/callback
ANSIBLE_FILTER_PLUGINS={toxinidir}/tripleo_ansible/ansible_plugins/filter
ANSIBLE_LIBRARY={toxinidir}/tripleo_ansible/roles.galaxy/config_template/library:{toxinidir}/tripleo_ansible/ansible_plugins/modules
ANSIBLE_MODULE_UTILS={toxinidir}/tripleo_ansible/ansible_plugins/module_utils
ANSIBLE_ROLES_PATH={toxinidir}/tripleo_ansible/roles.galaxy:{toxinidir}/tripleo_ansible/roles
ANSIBLE_INVENTORY={toxinidir}/tests/hosts.ini
ANSIBLE_NOCOWS=1
ANSIBLE_RETRY_FILES_ENABLED=0
ANSIBLE_STDOUT_CALLBACK=debug
ANSIBLE_LOG_PATH={envlogdir}/ansible-execution.log
VIRTUAL_ENV={envdir}
LC_ALL=en_US.UTF-8
# pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
# paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
PIP_DISABLE_PIP_VERSION_CHECK=1
sitepackages = True
deps =
-r {toxinidir}/test-requirements.txt
-r {toxinidir}/ansible-requirements.txt
commands =
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-collections-requirements.yml
stestr run {posargs}
allowlist_externals =
bash
tox
true
ansible-galaxy
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system
# dependencies are missing! This also means that bindep must be installed
# separately, outside of the requirements files.
deps = bindep
commands = bindep test
[testenv:linters]
skipsdist = True
skip_install = True
sitepackages = False
deps =
pre-commit
virtualenv
-r {toxinidir}/ansible-requirements.txt
commands =
bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/tripleo_ansible/roles.galaxy' \
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-role-requirements.yml"
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-collections-requirements.yml
python -m pre_commit run -a
[testenv:releasenotes]
basepython = python3
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r {toxinidir}/doc/requirements.txt
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees --keep-going -b html releasenotes/source releasenotes/build/html
[testenv:docs]
basepython = python3
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r {toxinidir}/doc/requirements.txt
commands=
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-collections-requirements.yml
doc8 doc
sphinx-build -a -E -W -d doc/build/doctrees --keep-going -b html doc/source doc/build/html -T
[doc8]
# Settings for doc8:
extensions = .rst
ignore = D001
[testenv:venv]
commands = {posargs}
[testenv:pep8]
description = "[deprecated], use linters instead."
deps =
commands = true
skipsdist = True
skip_install = True
sitepackages = False
[testenv:role-addition]
basepython = python3
deps =
{[testenv:linters]deps}
-r {toxinidir}/molecule-requirements.txt
commands =
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-collections-requirements.yml
bash -c "ansible-playbook -i localhost, role-addition.yml -e role_name=skeleton_test"
bash -c "if podman ps 2> /dev/null; then \
cd {toxinidir}/tripleo_ansible/roles/skeleton_test; \
molecule test --all; \
else \
echo -e '\n\nNo molecule tests have been executed\nSee https://docs.openstack.org/tripleo-ansible/latest/contributing.html#local-testing-of-new-roles\n\n'; \
fi"
{[testenv:linters]commands}
[testenv:modules]
deps=
{[testenv:linters]deps}
commands =
bash -c "cd {toxinidir}/tripleo_ansible/ansible_plugins/tests; molecule test --all;"
{[testenv:linters]commands}