Fix passenv declaration in tox.ini and function tests python env
While running the tests with the latest tox I was getting the following error message: ``` failed with pass_env values cannot contain whitespace, use comma to have multiple values in a single line' ``` That error is happening because of the passenv declaration. This patch is proposing a fix for that. Besides the `tox` issue, we also needed to create a patch for the use of virtual env inside DevStack. This patches presents a solution to run tests using the virtual env of DevStack. Change-Id: Id8249ebb15d4047dcc6181908eae66eb39722863
This commit is contained in:
parent
0835706738
commit
c45ad92e9d
|
@ -23,6 +23,7 @@
|
|||
CLOUDKITTY_FETCHER: keystone
|
||||
DEVSTACK_GATE_USE_PYTHON3: "True"
|
||||
USE_PYTHON3: True
|
||||
GLOBAL_VENV: False
|
||||
devstack_services:
|
||||
ck-api: true
|
||||
horizon: false
|
||||
|
|
|
@ -20,6 +20,10 @@ import subprocess
|
|||
|
||||
from cloudkittyclient.tests import utils
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class BaseFunctionalTest(utils.BaseTestCase):
|
||||
|
||||
|
@ -27,8 +31,16 @@ class BaseFunctionalTest(utils.BaseTestCase):
|
|||
flags='', params='', fmt='-f json', stdin=None, has_output=True):
|
||||
if not has_output:
|
||||
fmt = ''
|
||||
|
||||
system_variables = os.environ.copy()
|
||||
LOG.info("System variables [%s] found when executing the tests.",
|
||||
system_variables)
|
||||
|
||||
cmd = ' '.join([executable, flags, action, params, fmt])
|
||||
|
||||
LOG.info("Command being executed: [%s].", cmd)
|
||||
cmd = shlex.split(cmd)
|
||||
|
||||
p = subprocess.Popen(
|
||||
cmd, env=os.environ.copy(), shell=False,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
|
|
33
tox.ini
33
tox.ini
|
@ -9,6 +9,7 @@ basepython = python3
|
|||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv =
|
||||
DEVSTACK_VENV={env:DEVSTACK_VENV}
|
||||
VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
@ -29,12 +30,40 @@ commands =
|
|||
commands = oslo_debug_helper -t cloudkittyclient/tests {posargs}
|
||||
|
||||
[testenv:functional-v1]
|
||||
passenv = OS_CLOUD OS_PROJECT_DOMAIN_ID OS_USER_DOMAIN_ID OS_PROJECT_DOMAIN_NAME OS_USER_DOMAIN_NAME OS_PROJECT_NAME OS_IDENTITY_API_VERSION OS_PASSWORD OS_AUTH_TYPE OS_AUTH_URL OS_USERNAME OS_ENDPOINT
|
||||
passenv =
|
||||
OS_CLOUD
|
||||
OS_PROJECT_DOMAIN_ID
|
||||
OS_USER_DOMAIN_ID
|
||||
OS_PROJECT_DOMAIN_NAME
|
||||
OS_USER_DOMAIN_NAME
|
||||
OS_PROJECT_NAME
|
||||
OS_IDENTITY_API_VERSION
|
||||
OS_PASSWORD
|
||||
OS_AUTH_TYPE
|
||||
OS_AUTH_URL
|
||||
OS_USERNAME
|
||||
OS_ENDPOINT
|
||||
DEVSTACK_VENV
|
||||
VIRTUAL_ENV
|
||||
setenv = OS_RATING_API_VERSION=1
|
||||
commands = stestr run --concurrency=1 --test-path ./cloudkittyclient/tests/functional/v1
|
||||
|
||||
[testenv:functional-v2]
|
||||
passenv = OS_CLOUD OS_PROJECT_DOMAIN_ID OS_USER_DOMAIN_ID OS_PROJECT_DOMAIN_NAME OS_USER_DOMAIN_NAME OS_PROJECT_NAME OS_IDENTITY_API_VERSION OS_PASSWORD OS_AUTH_TYPE OS_AUTH_URL OS_USERNAME OS_ENDPOINT
|
||||
passenv =
|
||||
OS_CLOUD
|
||||
OS_PROJECT_DOMAIN_ID
|
||||
OS_USER_DOMAIN_ID
|
||||
OS_PROJECT_DOMAIN_NAME
|
||||
OS_USER_DOMAIN_NAME
|
||||
OS_PROJECT_NAME
|
||||
OS_IDENTITY_API_VERSION
|
||||
OS_PASSWORD
|
||||
OS_AUTH_TYPE
|
||||
OS_AUTH_URL
|
||||
OS_USERNAME
|
||||
OS_ENDPOINT
|
||||
DEVSTACK_VENV
|
||||
VIRTUAL_ENV
|
||||
setenv = OS_RATING_API_VERSION=2
|
||||
commands = stestr run --concurrency=1 --test-path ./cloudkittyclient/tests/functional/v2
|
||||
|
||||
|
|
Loading…
Reference in New Issue