Jesse Pretorius ff495ded2b Use centralised test scripts
This patch consumes the test scripts implemented by
https://review.openstack.org/375061 to ensure that
the tests and test preparation is consistent and
more maintainable.

Change-Id: I5ec2a2c47169e75ad2dbb801eac1732d51cdd2b8
2016-09-28 13:27:00 +01:00

232 lines
7.3 KiB
INI

[tox]
minversion = 2.0
skipsdist = True
envlist = docs,linters,functional
[testenv]
usedevelop = True
install_command =
pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps =
-r{toxinidir}/test-requirements.txt
commands =
/usr/bin/find . -type f -name "*.pyc" -delete
passenv =
HOME
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
whitelist_externals =
bash
setenv =
PYTHONUNBUFFERED=1
ROLE_NAME=os_swift
VIRTUAL_ENV={envdir}
WORKING_DIR={toxinidir}
[testenv:docs]
commands =
bash -c "rm -rf doc/build"
doc8 doc
python setup.py build_sphinx
[doc8]
# Settings for doc8:
extensions = .rst
[testenv:releasenotes]
commands =
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# environment used by the -infra templated docs job
[testenv:venv]
commands =
{posargs}
[testenv:tests_clone]
commands =
bash -c "if [ ! -d "{toxinidir}/tests/common" ]; then \
git clone https://git.openstack.org/openstack/openstack-ansible-tests {toxinidir}/tests/common; \
fi"
[testenv:pep8]
commands =
{[testenv:tests_clone]commands}
bash -c "{toxinidir}/tests/common/test-pep8.sh"
[flake8]
# Ignores the following rules due to how ansible modules work in general
# F403 'from ansible.module_utils.basic import *' used;
# unable to detect undefined names
# H303 No wildcard (*) import.
ignore=F403,H303
# The max-line-length is being set at a greater width in order to accommodate
# jinja templating in python files, especially in the shebang.
max-line-length = 120
[testenv:bashate]
commands =
{[testenv:tests_clone]commands}
bash -c "{toxinidir}/tests/common/test-bashate.sh"
[testenv:ansible]
deps =
{[testenv]deps}
-rhttp://git.openstack.org/cgit/openstack/openstack-ansible-tests/plain/test-ansible-deps.txt
commands =
{[testenv:tests_clone]commands}
bash -c "{toxinidir}/tests/common/test-ansible-env-prep.sh"
[testenv:ansible-syntax]
deps =
{[testenv:ansible]deps}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
--syntax-check \
--list-tasks \
{toxinidir}/tests/test.yml
[testenv:ansible-lint]
deps =
{[testenv:ansible]deps}
commands =
{[testenv:ansible]commands}
ansible-lint {toxinidir}
[testenv:func_base]
# NOTE(odyssey4me): this target does not use constraints because
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
install_command =
pip install -U --force-reinstall {opts} {packages}
[testenv:func_logs]
commands =
bash -c "{toxinidir}/tests/common/test-log-collect.sh"
[testenv:functional]
# Ignore_errors is set to true so that the logs are collected at the
# end of the run. This will not produce a false positive. Any
# exception will be mark the run as failed and exit 1 after all of
# the commands have been iterated through.
ignore_errors = True
# NOTE(andymccr): this will test standard Swift install.
install_command =
{[testenv:func_base]install_command}
deps =
{[testenv:ansible]deps}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides.yml \
{toxinidir}/tests/test.yml -vvvv
ansible-playbook -i {toxinidir}/tests/inventory \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides.yml \
{toxinidir}/tests/test-swift-functional.yml -vvvv
{[testenv:func_logs]commands}
# NOTE(andymccr): this will test Swift running in pypy.
[testenv:func_pypy]
# Ignore_errors is set to true so that the logs are collected at the
# end of the run. This will not produce a false positive. Any
# exception will be mark the run as failed and exit 1 after all of
# the commands have been iterated through.
ignore_errors = True
install_command =
{[testenv:func_base]install_command}
deps =
{[testenv:ansible]deps}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides.yml \
-e "swift_pypy_enabled=True" \
{toxinidir}/tests/test.yml -vvvv
ansible-playbook -i {toxinidir}/tests/inventory \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides.yml \
-e "swift_pypy_enabled=True" \
{toxinidir}/tests/test-swift-functional.yml -vvvv
{[testenv:func_logs]commands}
# NOTE(andmccr): this will test a MR Swift deploy.
[testenv:multi_reg]
# Ignore_errors is set to true so that the logs are collected at the
# end of the run. This will not produce a false positive. Any
# exception will be mark the run as failed and exit 1 after all of
# the commands have been iterated through.
ignore_errors = True
install_command =
{[testenv:func_base]install_command}
deps =
{[testenv:ansible]deps}
commands =
{[testenv:ansible]commands}
# Setup the host and Region A
# NB we run against swift_all only since region B hosts don't exist yet.
ansible-playbook -i {toxinidir}/tests/inventory_MR_A \
-e "install_test_packages=True" \
-e "swift_do_setup=True" \
-e "swift_do_sync=False" \
-e "swift_groups='swift_all'" \
-e @{toxinidir}/tests/swift-overrides-MR-A.yml \
{toxinidir}/tests/test.yml -vvvv
# Setup region B Swift only and sync rings.
ansible-playbook -i {toxinidir}/tests/inventory_MR_B \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides-MR-B.yml \
{toxinidir}/tests/common/test-install-swift.yml -vvvv
# Sync rings from region A
ansible-playbook -i {toxinidir}/tests/inventory_MR_A \
-e "install_test_packages=True" \
-e "swift_do_setup=False" \
-e "swift_do_sync=True" \
-e @{toxinidir}/tests/swift-overrides-MR-A.yml \
{toxinidir}/tests/common/test-install-swift.yml -vvvv
# Run functional tests against region A
ansible-playbook -i {toxinidir}/tests/inventory_MR_A \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides-MR-A.yml \
{toxinidir}/tests/test-swift-functional.yml -vvvv
# Run functional tests against region B
ansible-playbook -i {toxinidir}/tests/inventory_MR_B \
-e "install_test_packages=True" \
-e @{toxinidir}/tests/swift-overrides-MR-B.yml \
{toxinidir}/tests/test-swift-functional.yml -vvvv
{[testenv:func_logs]commands}
[testenv:linters]
deps =
{[testenv:ansible]deps}
commands =
{[testenv:pep8]commands}
{[testenv:bashate]commands}
{[testenv:ansible-lint]commands}
{[testenv:ansible-syntax]commands}
{[testenv:docs]commands}