diff options
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-ceilometer/skip-failed-unsupported-db-ceilometer-builtin-tests.patch')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-ceilometer/skip-failed-unsupported-db-ceilometer-builtin-tests.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer/skip-failed-unsupported-db-ceilometer-builtin-tests.patch b/meta-openstack/recipes-devtools/python/python-ceilometer/skip-failed-unsupported-db-ceilometer-builtin-tests.patch new file mode 100644 index 0000000..196f71e --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-ceilometer/skip-failed-unsupported-db-ceilometer-builtin-tests.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | skip failed unsupported db ceilometer builtin tests | ||
| 2 | |||
| 3 | Some ceilometer builtin testcases failed because they try to | ||
| 4 | test ceilometer functionalities on top of unsupported database, | ||
| 5 | e.g. mongodb or db2. These testcases should be skipped instead | ||
| 6 | of letting them fail as the prerequisite is not satisfied. | ||
| 7 | |||
| 8 | Signed-off-by: Vu Tran <vu.tran@windriver.com> | ||
| 9 | |||
| 10 | diff --git a/ceilometer/tests/db.py b/ceilometer/tests/db.py | ||
| 11 | index 293e022..d64c61c 100644 | ||
| 12 | --- a/ceilometer/tests/db.py | ||
| 13 | +++ b/ceilometer/tests/db.py | ||
| 14 | @@ -35,7 +35,7 @@ | ||
| 15 | def setUp(self): | ||
| 16 | super(TestBase, self).setUp() | ||
| 17 | |||
| 18 | - if self.database_connection is None: | ||
| 19 | + if self.database_connection is None or str(self.database_connection) == "": | ||
| 20 | self.skipTest("No connection URL set") | ||
| 21 | |||
| 22 | self.CONF = self.useFixture(config.Config()).conf | ||
| 23 | @@ -75,13 +75,12 @@ class MongoDBFakeConnectionUrl(object): | ||
| 24 | |||
| 25 | def __init__(self): | ||
| 26 | self.url = os.environ.get('CEILOMETER_TEST_MONGODB_URL') | ||
| 27 | - if not self.url: | ||
| 28 | - raise RuntimeError( | ||
| 29 | - "No MongoDB test URL set," | ||
| 30 | - "export CEILOMETER_TEST_MONGODB_URL environment variable") | ||
| 31 | |||
| 32 | def __str__(self): | ||
| 33 | - return '%(url)s_%(db)s' % dict(url=self.url, db=uuid.uuid4().hex) | ||
| 34 | + if not self.url: | ||
| 35 | + return "" | ||
| 36 | + else: | ||
| 37 | + return '%(url)s_%(db)s' % dict(url=self.url, db=uuid.uuid4().hex) | ||
| 38 | |||
| 39 | |||
| 40 | class DB2FakeConnectionUrl(MongoDBFakeConnectionUrl): | ||
| 41 | @@ -89,9 +88,7 @@ class DB2FakeConnectionUrl(MongoDBFakeConnectionUrl): | ||
| 42 | self.url = (os.environ.get('CEILOMETER_TEST_DB2_URL') or | ||
| 43 | os.environ.get('CEILOMETER_TEST_MONGODB_URL')) | ||
| 44 | if not self.url: | ||
| 45 | - raise RuntimeError( | ||
| 46 | - "No DB2 test URL set, " | ||
| 47 | - "export CEILOMETER_TEST_DB2_URL environment variable") | ||
| 48 | + pass | ||
| 49 | else: | ||
| 50 | # This is to make sure that the db2 driver is used when | ||
| 51 | # CEILOMETER_TEST_DB2_URL was not set | ||
