From f86486f9ccb99115333691586ed4e99f074edc23 Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Thu, 19 Jun 2014 10:33:03 -0400 Subject: ceilometer builtin skip failed unsupported db tests ceilometer tests against various databases: mongodb, db2, sqlalchemy, hbase. For mongodb and db2, tests use environment variables: CEILOMETER_TEST_MONGODB_URL and CEILOMETER_TEST_DB2_URL for supplying URL database connection into tests. As we do not support mangodb or db2, by not setting or setting bogus URLs to these two environment variables will cause tests to fail. These tests should be skipped as prerequisite is not satisfied. Therefore we modify ceilometer testcases for mongodb and db2 to be skipped instead of failed if CEILOMETER_TEST_MONGODB_URL and CEILOMETER_TEST_DB2_URL are not set. Signed-off-by: Vu Tran --- ...e-known-protocol-scheme-in-keystone-tests.patch | 85 ---------------------- ...d-unsupported-db-ceilometer-builtin-tests.patch | 51 +++++++++++++ .../python/python-ceilometer_git.bb | 2 +- 3 files changed, 52 insertions(+), 86 deletions(-) delete mode 100644 meta-openstack/recipes-devtools/python/python-ceilometer/Use-known-protocol-scheme-in-keystone-tests.patch create mode 100644 meta-openstack/recipes-devtools/python/python-ceilometer/skip-failed-unsupported-db-ceilometer-builtin-tests.patch (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer/Use-known-protocol-scheme-in-keystone-tests.patch b/meta-openstack/recipes-devtools/python/python-ceilometer/Use-known-protocol-scheme-in-keystone-tests.patch deleted file mode 100644 index 7756dca..0000000 --- a/meta-openstack/recipes-devtools/python/python-ceilometer/Use-known-protocol-scheme-in-keystone-tests.patch +++ /dev/null @@ -1,85 +0,0 @@ -Use known protocol scheme in keystone tests - -Commit e5b7606eaa94033256eb1aca5f6a6eed4f9e54a0 from -https://github.com/openstack/ceilometer.git master - -With the recent introduction of the identity_uri in keystoneclient, -there is a small backward incompatible change which means that weird -protocols like the ones we use during tests aren't support properly -anymore. The patch replaces "foottp" and "barttp" by "file" hopefully -keeping testing coverage the same. - -Change-Id: Idb30ff3ee0ca50911e453899ad32e630f9b18724 -Closes-Bug: #1309092 - -diff --git a/ceilometer/tests/api/v1/test_app.py b/ceilometer/tests/api/v1/test_app.py -index fed5b8b..b25b7ef 100644 ---- a/ceilometer/tests/api/v1/test_app.py -+++ b/ceilometer/tests/api/v1/test_app.py -@@ -34,17 +34,17 @@ class TestApp(test.BaseTestCase): - self.CONF = self.useFixture(config.Config()).conf - - def test_keystone_middleware_conf(self): -- self.CONF.set_override("auth_protocol", "foottp", -+ self.CONF.set_override("auth_protocol", "file", - group=acl.OPT_GROUP_NAME) - self.CONF.set_override("auth_version", "v2.0", - group=acl.OPT_GROUP_NAME) - self.CONF.set_override("auth_uri", None, - group=acl.OPT_GROUP_NAME) - api_app = app.make_app(self.CONF, attach_storage=False) -- self.assertTrue(api_app.wsgi_app.auth_uri.startswith('foottp')) -+ self.assertTrue(api_app.wsgi_app.auth_uri.startswith('file')) - - def test_keystone_middleware_parse_conffile(self): -- content = "[{0}]\nauth_protocol = barttp"\ -+ content = "[{0}]\nauth_protocol = file"\ - "\nauth_version = v2.0".format(acl.OPT_GROUP_NAME) - tmpfile = fileutils.write_to_tempfile(content=content, - prefix='ceilometer', -@@ -52,5 +52,5 @@ class TestApp(test.BaseTestCase): - service.prepare_service(['ceilometer-api', - '--config-file=%s' % tmpfile]) - api_app = app.make_app(self.CONF, attach_storage=False) -- self.assertTrue(api_app.wsgi_app.auth_uri.startswith('barttp')) -+ self.assertTrue(api_app.wsgi_app.auth_uri.startswith('file')) - os.unlink(tmpfile) -diff --git a/ceilometer/tests/api/v2/test_app.py b/ceilometer/tests/api/v2/test_app.py -index 0b3ebcf..4e624bd 100644 ---- a/ceilometer/tests/api/v2/test_app.py -+++ b/ceilometer/tests/api/v2/test_app.py -@@ -42,7 +42,7 @@ class TestApp(base.BaseTestCase): - self.CONF = self.useFixture(config.Config()).conf - - def test_keystone_middleware_conf(self): -- self.CONF.set_override("auth_protocol", "foottp", -+ self.CONF.set_override("auth_protocol", "file", - group=acl.OPT_GROUP_NAME) - self.CONF.set_override("auth_version", "v2.0", - group=acl.OPT_GROUP_NAME) -@@ -52,14 +52,14 @@ class TestApp(base.BaseTestCase): - self.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME) - - api_app = app.setup_app() -- self.assertTrue(api_app.auth_uri.startswith('foottp')) -+ self.assertTrue(api_app.auth_uri.startswith('file')) - - def test_keystone_middleware_parse_conffile(self): - pipeline_conf = self.path_get("/etc/ceilometer/pipeline.yaml") - content = "[DEFAULT]\n"\ - "pipeline_cfg_file = {0}\n"\ - "[{1}]\n"\ -- "auth_protocol = barttp\n"\ -+ "auth_protocol = file\n"\ - "auth_version = v2.0\n".format(pipeline_conf, - acl.OPT_GROUP_NAME) - -@@ -70,7 +70,7 @@ class TestApp(base.BaseTestCase): - '--config-file=%s' % tmpfile]) - self.CONF.set_override('connection', "log://", group="database") - api_app = app.setup_app() -- self.assertTrue(api_app.auth_uri.startswith('barttp')) -+ self.assertTrue(api_app.auth_uri.startswith('file')) - os.unlink(tmpfile) - - 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 @@ +skip failed unsupported db ceilometer builtin tests + +Some ceilometer builtin testcases failed because they try to +test ceilometer functionalities on top of unsupported database, +e.g. mongodb or db2. These testcases should be skipped instead +of letting them fail as the prerequisite is not satisfied. + +Signed-off-by: Vu Tran + +diff --git a/ceilometer/tests/db.py b/ceilometer/tests/db.py +index 293e022..d64c61c 100644 +--- a/ceilometer/tests/db.py ++++ b/ceilometer/tests/db.py +@@ -35,7 +35,7 @@ + def setUp(self): + super(TestBase, self).setUp() + +- if self.database_connection is None: ++ if self.database_connection is None or str(self.database_connection) == "": + self.skipTest("No connection URL set") + + self.CONF = self.useFixture(config.Config()).conf +@@ -75,13 +75,12 @@ class MongoDBFakeConnectionUrl(object): + + def __init__(self): + self.url = os.environ.get('CEILOMETER_TEST_MONGODB_URL') +- if not self.url: +- raise RuntimeError( +- "No MongoDB test URL set," +- "export CEILOMETER_TEST_MONGODB_URL environment variable") + + def __str__(self): +- return '%(url)s_%(db)s' % dict(url=self.url, db=uuid.uuid4().hex) ++ if not self.url: ++ return "" ++ else: ++ return '%(url)s_%(db)s' % dict(url=self.url, db=uuid.uuid4().hex) + + + class DB2FakeConnectionUrl(MongoDBFakeConnectionUrl): +@@ -89,9 +88,7 @@ class DB2FakeConnectionUrl(MongoDBFakeConnectionUrl): + self.url = (os.environ.get('CEILOMETER_TEST_DB2_URL') or + os.environ.get('CEILOMETER_TEST_MONGODB_URL')) + if not self.url: +- raise RuntimeError( +- "No DB2 test URL set, " +- "export CEILOMETER_TEST_DB2_URL environment variable") ++ pass + else: + # This is to make sure that the db2 driver is used when + # CEILOMETER_TEST_DB2_URL was not set diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb index 4f557e1..5e0ad94 100644 --- a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb +++ b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb @@ -13,7 +13,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/icehouse \ file://0001-sqlalchemy-fix-grouping-for-postgresql-databases.patch \ file://fix_ceilometer_memory_leak.patch \ file://ceilometer-builtin-tests-config-location.patch \ - file://Use-known-protocol-scheme-in-keystone-tests.patch \ + file://skip-failed-unsupported-db-ceilometer-builtin-tests.patch \ " SRCREV="c8733b2bc1301bc8dd5119a630d855ace1c747bf" -- cgit v1.2.3-54-g00ecf