Split and fix live db tests

With this commit, it's now possible to only run live tests (i.e. on real
database) on certain backend. Typically, I don't have HBase installed, so
now I can run the live tests against MongoDB and MySQL only very easily.

Change-Id: I0e584b8243abc27ab9f027fdea17dc6c1192c62d
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou
2013-03-27 13:55:52 +01:00
parent a284960c37
commit 473dce84b8
9 changed files with 54 additions and 77 deletions

View File

@@ -248,13 +248,8 @@ class Connection(base.Connection):
LOG.info('connecting to MongoDB on %s:%s', opts['host'], opts['port'])
if opts['host'] == '__test__':
live_tests = bool(int(os.environ.get('CEILOMETER_TEST_LIVE', 0)))
if live_tests:
url = os.environ.get('CEILOMETER_TEST_MONGO_URL')
if not url:
raise RuntimeError("CEILOMETER_TEST_LIVE is on, but "
"CEILOMETER_TEST_MONGO_URL "
"is not defined")
url = os.environ.get('CEILOMETER_TEST_MONGODB_URL')
if url:
opts = self._parse_connection_url(url)
self.conn = pymongo.Connection(opts['host'],
opts['port'],