tests: read config file if GABBI_LIVE is set

When making the tests not read the default configuration files, we
actually broke the gating on Gabbi live tests. These tests need to read
the configuration file that is set up by devstack in the gate, since it
contains the configuration for the storage and indexer.

Change-Id: I81e6c19c26b0eb07e34ed5ad9400b115b140709d
This commit is contained in:
Julien Danjou 2016-01-08 09:33:40 +01:00
parent 66b6fb6c2e
commit 3326fab10e
3 changed files with 7 additions and 4 deletions

View File

@ -76,12 +76,15 @@ class ConfigFixture(fixture.GabbiFixture):
data_tmp_dir = tempfile.mkdtemp(prefix='gnocchi')
if os.getenv("GABBI_LIVE"):
dcf = None
else:
dcf = []
default_opts = [('url',
os.environ.get("GNOCCHI_TEST_INDEXER_URL", "null://"),
'indexer')]
conf = service.prepare_service([], default_opts,
default_config_files=[])
default_config_files=dcf)
CONF = self.conf = conf
self.tmp_dir = data_tmp_dir

View File

@ -44,5 +44,5 @@ def load_tests(loader, tests, pattern):
host=parsed_url.hostname,
port=port,
prefix=prefix)
elif os.getenv("GABBI_LIVE_FAIL_IF_NO_TEST"):
elif os.getenv("GABBI_LIVE"):
raise RuntimeError('"GNOCCHI_SERVICE_URL" is not set')

View File

@ -35,7 +35,7 @@ commands = flake8
[testenv:py27-gate]
setenv = OS_TEST_PATH=gnocchi/tests/gabbi
GABBI_LIVE_FAIL_IF_NO_TEST=1
GABBI_LIVE=1
passenv = {[testenv]passenv} GNOCCHI_SERVICE*
sitepackages = True
basepython = python2.7