From d982db62642740c5af57b1be2b445132d15e2964 Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Wed, 15 Jul 2020 00:05:48 +0200 Subject: [PATCH] Fix and improve cross-project functional testing Make sure stestr is executed using the python interpreter set inside the virtualenv, otherwise the libraries installed there may not found. This is due to the fact that (stestr default shebang points to system python when installed through devstack and the functional tox target uses that version thanks to sitepackages=True. The sitepackages option must be used to find a few system ceph/python libraries not available on pypi. Setting PATH is not really needed nowadays, so remove the custom workaround. It is worth noting that the hack would not be needed anymore and PATH could be set through setenv (extending {env:PATH}). As cinderlib changes can break cinder and cinder-tempest-plugin, and they indeed did it in the past, so ensure that everything works by running cinder-tempest-plugin-lvm-lio-barbican. Change-Id: I40ef42b4224521abed00b3b210418ec96c1116ea --- .zuul.yaml | 2 ++ tox.ini | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index aeddf07..571500c 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -11,6 +11,7 @@ - cinderlib-lvm-functional - cinderlib-ceph-functional + - cinder-tempest-plugin-lvm-lio-barbican gate: queue: integrated jobs: @@ -20,6 +21,7 @@ - cinderlib-lvm-functional - cinderlib-ceph-functional + - cinder-tempest-plugin-lvm-lio-barbican post: jobs: - publish-openstack-python-branch-tarball diff --git a/tox.ini b/tox.ini index 59497e3..750b482 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,6 @@ passenv = CL_FTEST_POOL_NAME setenv = OS_TEST_PATH=./cinderlib/tests/functional CL_FTEST_CFG={env:CL_FTEST_CFG:{toxinidir}/cinderlib/tests/functional/lvm.yaml} CL_FTEST_ROOT_HELPER={env:CL_FTEST_ROOT_HELPER:{toxinidir}/tools/virtualenv-sudo.sh} - ADD_PATHS=/usr/local/sbin:/usr/sbin sitepackages = True # Not reusing py37's env due to https://github.com/tox-dev/tox/issues/477 @@ -48,12 +47,13 @@ sitepackages = True # Must run serially or test_stats_with_creation may fail occasionally commands = find . -ignore_readdir_race -type f -name "*.pyc" -delete - # Tox has a bug and it ignores the PATH set in setenv, so we work around it - bash -i -c "PATH=$PATH:$ADD_PATHS stestr run --serial {posargs}" - stestr slowest + # run stestr through python -m so that the python from the virtualenv + # is used; stestr's shebang may point to system python, thus breaking + # the lookup of modules from the venv. + python -m stestr run --serial {posargs} + python -m stestr slowest whitelist_externals = - bash find stestr