tripleo-heat-templates/tox.ini
Sofer Athlan-Guyot 90c52db21e Ensure container's image get updated if their name stay the same.
In some environment the containers' tag isn't modified (think
"latest"). This is already supported during deployment so we re-use
the code during update.

We also make sure that the same mechanism is available for
ovn_controller update. It can be selectively disable if one pass:

    --skip-tags ovn_image

to the external-update run command.

We remove the ignore error as it's wrong indication that we are not
taking errors into account in those tasks. We also adjust the
delay as it's 3 seconds by default making the time we check longer
than the async tasks. Eventually, we add a new parameter for
controlling the downloading of the image
"OVNControllerImageUpdateTimeout" which is set to 10min by default.

Note that in order to pass CI, we need to modify the tht syntax test:
 - ensure containers.podman collection is installed;
 - ensure custom tripleo-ansible filter are found;
 - make sure tripleo_role_name is defined in the syntax test playbook.

Change-Id: I6d439367816d5f5968b8f890f74b7a2f74715f52
2022-09-27 12:20:54 +02:00

128 lines
3.9 KiB
INI

[tox]
minversion = 3.18.0
skipsdist = True
envlist = pep8,py,tht
requires =
# extra plugin returns error if git reports untracked or dirty files
tox-extra>=0.0.0
[testenv]
basepython = python3
usedevelop = True
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
stestr run {posargs}
stestr slowest
setenv =
LC_ALL=en_US.UTF-8
[testenv:venv]
commands = {posargs}
[testenv:pep8]
allowlist_externals =
bash
commands =
python ./tools/process-templates.py
python ./tools/yaml-validate.py . --skip-dir .tox --skip-dir releasenotes --skip-dir zuul.d
bash -c ./tools/roles-data-validation.sh
bash -c ./tools/check-up-to-date.sh
flake8
ansible-lint -v
[flake8]
# E125 is deliberately excluded. See
# https://github.com/jcrocholl/pep8/issues/126. It's just wrong.
#
# Most of the whitespace related rules (E12* and E131) are excluded
# because while they are often useful guidelines, strict adherence to
# them ends up causing some really odd code formatting and forced
# extra line breaks. Updating code to enforce these will be a hard sell.
#
# H405 is another one that is good as a guideline, but sometimes
# multiline doc strings just don't have a natural summary
# line. Rejecting code for this reason is wrong.
#
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
#
# The following two are also ignored that we don't think it is useful.
# W503 line break before binary operator
# W504 line break after binary operator
#
# The following rules are currently ignored, but will be enforced
# in the future
# E501 line too long
# E731 do not assign a lambda expression, use a def
# W605 invalid escape sequence
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405,W503,W504,E501,E731,W605
exclude = releasenotes,.cache,.tox,__pycache__,tripleo_heat_templates/tests/tripleo-ansible,tripleo_heat_templates/tests/ansible-pacemaker
[testenv:templates]
commands = python ./tools/process-templates.py
[testenv:clean]
commands = python ./tools/process-templates.py -c
[testenv:releasenotes]
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
allowlist_externals =
bash
commands = bash -c tools/releasenotes_tox.sh
[testenv:cover]
setenv =
PYTHON=coverage run --source tripleo_heat_templates --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage html -d cover
coverage xml -o cover/coverage.xml
coverage report
[testenv:genconfig]
commands =
python ./tools/process-templates.py
python ./tripleo_heat_templates/environment_generator.py sample-env-generator/
[testenv:genroledata]
allowlist_externals =
bash
commands =
bash -c tools/roles-data-generate-samples.sh
[testenv:tht]
usedevelop = True
setenv =
ANSIBLE_FORCE_COLOR=1
ANSIBLE_INVENTORY={toxinidir}/test/hosts.ini
ANSIBLE_THT_FOLDER={toxinidir}
ANSIBLE_NOCOWS=1
ANSIBLE_RETRY_FILES_ENABLED=0
ANSIBLE_STDOUT_CALLBACK=debug
PY_COLORS=1
VIRTUAL_ENV={envdir}
# Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command
PIP_DISABLE_PIP_VERSION_CHECK=1
passenv =
ANSIBLE_*
deps =
-r{toxinidir}/test-ansible-requirements.txt
-r{toxinidir}/test-requirements.txt
allowlist_externals =
bash
commands_pre =
ansible-galaxy collection install ansible.posix containers.podman
pip install -q bindep fixtures
bindep test
commands =
pytest --color=no \
--html={envlogdir}/reports.html \
--self-contained-html \
{toxinidir}/tripleo_heat_templates/tests/test_tht_ansible_syntax.py {toxinidir}/tripleo_heat_templates/tests/test_tht_derivce_pci.py