diff options
| author | Vu Tran <vu.tran@windriver.com> | 2014-06-19 10:33:03 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-06-23 15:54:54 -0400 |
| commit | f86486f9ccb99115333691586ed4e99f074edc23 (patch) | |
| tree | 66290ee039ce34e3a7f58815bc2f8c59724be4b1 /meta-openstack/recipes-devtools/python/python-ceilometer | |
| parent | b39dc4c0b5aa1cf35d89d3f72673d24083a0a92f (diff) | |
| download | meta-cloud-services-f86486f9ccb99115333691586ed4e99f074edc23.tar.gz | |
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 <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-ceilometer')
2 files changed, 51 insertions, 85 deletions
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 @@ | |||
| 1 | Use known protocol scheme in keystone tests | ||
| 2 | |||
| 3 | Commit e5b7606eaa94033256eb1aca5f6a6eed4f9e54a0 from | ||
| 4 | https://github.com/openstack/ceilometer.git master | ||
| 5 | |||
| 6 | With the recent introduction of the identity_uri in keystoneclient, | ||
| 7 | there is a small backward incompatible change which means that weird | ||
| 8 | protocols like the ones we use during tests aren't support properly | ||
| 9 | anymore. The patch replaces "foottp" and "barttp" by "file" hopefully | ||
| 10 | keeping testing coverage the same. | ||
| 11 | |||
| 12 | Change-Id: Idb30ff3ee0ca50911e453899ad32e630f9b18724 | ||
| 13 | Closes-Bug: #1309092 | ||
| 14 | |||
| 15 | diff --git a/ceilometer/tests/api/v1/test_app.py b/ceilometer/tests/api/v1/test_app.py | ||
| 16 | index fed5b8b..b25b7ef 100644 | ||
| 17 | --- a/ceilometer/tests/api/v1/test_app.py | ||
| 18 | +++ b/ceilometer/tests/api/v1/test_app.py | ||
| 19 | @@ -34,17 +34,17 @@ class TestApp(test.BaseTestCase): | ||
| 20 | self.CONF = self.useFixture(config.Config()).conf | ||
| 21 | |||
| 22 | def test_keystone_middleware_conf(self): | ||
| 23 | - self.CONF.set_override("auth_protocol", "foottp", | ||
| 24 | + self.CONF.set_override("auth_protocol", "file", | ||
| 25 | group=acl.OPT_GROUP_NAME) | ||
| 26 | self.CONF.set_override("auth_version", "v2.0", | ||
| 27 | group=acl.OPT_GROUP_NAME) | ||
| 28 | self.CONF.set_override("auth_uri", None, | ||
| 29 | group=acl.OPT_GROUP_NAME) | ||
| 30 | api_app = app.make_app(self.CONF, attach_storage=False) | ||
| 31 | - self.assertTrue(api_app.wsgi_app.auth_uri.startswith('foottp')) | ||
| 32 | + self.assertTrue(api_app.wsgi_app.auth_uri.startswith('file')) | ||
| 33 | |||
| 34 | def test_keystone_middleware_parse_conffile(self): | ||
| 35 | - content = "[{0}]\nauth_protocol = barttp"\ | ||
| 36 | + content = "[{0}]\nauth_protocol = file"\ | ||
| 37 | "\nauth_version = v2.0".format(acl.OPT_GROUP_NAME) | ||
| 38 | tmpfile = fileutils.write_to_tempfile(content=content, | ||
| 39 | prefix='ceilometer', | ||
| 40 | @@ -52,5 +52,5 @@ class TestApp(test.BaseTestCase): | ||
| 41 | service.prepare_service(['ceilometer-api', | ||
| 42 | '--config-file=%s' % tmpfile]) | ||
| 43 | api_app = app.make_app(self.CONF, attach_storage=False) | ||
| 44 | - self.assertTrue(api_app.wsgi_app.auth_uri.startswith('barttp')) | ||
| 45 | + self.assertTrue(api_app.wsgi_app.auth_uri.startswith('file')) | ||
| 46 | os.unlink(tmpfile) | ||
| 47 | diff --git a/ceilometer/tests/api/v2/test_app.py b/ceilometer/tests/api/v2/test_app.py | ||
| 48 | index 0b3ebcf..4e624bd 100644 | ||
| 49 | --- a/ceilometer/tests/api/v2/test_app.py | ||
| 50 | +++ b/ceilometer/tests/api/v2/test_app.py | ||
| 51 | @@ -42,7 +42,7 @@ class TestApp(base.BaseTestCase): | ||
| 52 | self.CONF = self.useFixture(config.Config()).conf | ||
| 53 | |||
| 54 | def test_keystone_middleware_conf(self): | ||
| 55 | - self.CONF.set_override("auth_protocol", "foottp", | ||
| 56 | + self.CONF.set_override("auth_protocol", "file", | ||
| 57 | group=acl.OPT_GROUP_NAME) | ||
| 58 | self.CONF.set_override("auth_version", "v2.0", | ||
| 59 | group=acl.OPT_GROUP_NAME) | ||
| 60 | @@ -52,14 +52,14 @@ class TestApp(base.BaseTestCase): | ||
| 61 | self.CONF.set_override("auth_uri", None, group=acl.OPT_GROUP_NAME) | ||
| 62 | |||
| 63 | api_app = app.setup_app() | ||
| 64 | - self.assertTrue(api_app.auth_uri.startswith('foottp')) | ||
| 65 | + self.assertTrue(api_app.auth_uri.startswith('file')) | ||
| 66 | |||
| 67 | def test_keystone_middleware_parse_conffile(self): | ||
| 68 | pipeline_conf = self.path_get("/etc/ceilometer/pipeline.yaml") | ||
| 69 | content = "[DEFAULT]\n"\ | ||
| 70 | "pipeline_cfg_file = {0}\n"\ | ||
| 71 | "[{1}]\n"\ | ||
| 72 | - "auth_protocol = barttp\n"\ | ||
| 73 | + "auth_protocol = file\n"\ | ||
| 74 | "auth_version = v2.0\n".format(pipeline_conf, | ||
| 75 | acl.OPT_GROUP_NAME) | ||
| 76 | |||
| 77 | @@ -70,7 +70,7 @@ class TestApp(base.BaseTestCase): | ||
| 78 | '--config-file=%s' % tmpfile]) | ||
| 79 | self.CONF.set_override('connection', "log://", group="database") | ||
| 80 | api_app = app.setup_app() | ||
| 81 | - self.assertTrue(api_app.auth_uri.startswith('barttp')) | ||
| 82 | + self.assertTrue(api_app.auth_uri.startswith('file')) | ||
| 83 | os.unlink(tmpfile) | ||
| 84 | |||
| 85 | |||
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 | ||
