Merge "tox: Integrate tox-docker"

This commit is contained in:
Zuul 2019-05-17 05:42:08 +00:00 committed by Gerrit Code Review
commit a0c2993411
3 changed files with 26 additions and 6 deletions

View File

@ -14,11 +14,13 @@ Detailed information on testing can be found here: https://wiki.openstack.org/wi
More information on pip here: http://www.pip-installer.org/en/latest/
*Use pip to install tox*::
*Use pip to install tox and tox-docker*::
pip install tox
pip install tox tox-docker
As of zuul v3, a running zookeeper is required to execute tests.
As of zuul v3, a running zookeeper is required to execute tests. Using the
``-docker`` suffixed commands will ensure this is started automatically by tox,
but if you do not wish to use this:
*Install zookeeper*::

View File

@ -2065,7 +2065,20 @@ class ChrootedKazooFixture(fixtures.Fixture):
def __init__(self, test_id):
super(ChrootedKazooFixture, self).__init__()
zk_host = os.environ.get('NODEPOOL_ZK_HOST', 'localhost')
if 'ZOOKEEPER_2181_TCP' in os.environ:
# prevent any nasty hobbits^H^H^H suprises
if 'NODEPOOL_ZK_HOST' in os.environ:
raise Exception(
'Looks like tox-docker is being used but you have also '
'configured NODEPOOL_ZK_HOST. Either avoid using the '
'docker environment or unset NODEPOOL_ZK_HOST.')
zk_host = 'localhost:' + os.environ['ZOOKEEPER_2181_TCP']
elif 'NODEPOOL_ZK_HOST' in os.environ:
zk_host = os.environ['NODEPOOL_ZK_HOST']
else:
zk_host = 'localhost'
if ':' in zk_host:
host, port = zk_host.split(':')
else:

View File

@ -1,8 +1,11 @@
[tox]
minversion = 3.1
minversion = 3.2
skipsdist = True
envlist = pep8,py35
envlist = pep8,py35{-docker}
ignore_basepython_conflict = True
# TODO(stephenfin): It would be good to set 'requires = tox-docker', but doing
# so borks the tools/pip.sh wrapper we're using here and probably isn't what
# we want in the gate :(
[testenv]
basepython = python3
@ -28,6 +31,8 @@ whitelist_externals = bash
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
docker =
docker: zookeeper:3.4
commands =
bash -c 'stestr run --concurrency=`python -c "import multiprocessing; print(int(multiprocessing.cpu_count()/2))"` {posargs}'
stestr slowest