From 87d8891d9317b5be295ded1b245a6a3ddd3aba64 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Fri, 26 Jun 2015 01:30:34 -0400 Subject: [PATCH] remove non-cache related options assignment and role options should stay in keystone, this is also causing issues when generating a new config file since it can't register duplicate option names Change-Id: I9ea956738d590990679726b8d4938827d6f8d606 --- oslo_cache/_opts.py | 23 ----------------------- oslo_cache/tests/test_cache.py | 24 +++++++++++++++++------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/oslo_cache/_opts.py b/oslo_cache/_opts.py index 2dffc9a4..677a4776 100644 --- a/oslo_cache/_opts.py +++ b/oslo_cache/_opts.py @@ -92,29 +92,6 @@ FILE_OPTIONS = { help='Number of seconds that an operation will wait to get ' 'a memcache client connection.'), ], - 'role': [ - # The role driver has no default for backward compatibility reasons. - # If role driver is not specified, the assignment driver chooses - # the backend - cfg.StrOpt('driver', - help='Role backend driver.'), - cfg.BoolOpt('caching', default=True, - help='Toggle for role caching. This has no effect ' - 'unless global caching is enabled.'), - cfg.IntOpt('cache_time', - help='TTL (in seconds) to cache role data. This has ' - 'no effect unless global caching is enabled.'), - cfg.IntOpt('list_limit', - help='Maximum number of entities that will be returned ' - 'in a role collection.'), - ], - 'assignment': [ - # assignment has no default for backward compatibility reasons. - # If assignment driver is not specified, the identity driver chooses - # the backend - cfg.StrOpt('driver', - help='Assignment backend driver.'), - ], } diff --git a/oslo_cache/tests/test_cache.py b/oslo_cache/tests/test_cache.py index 34cd353f..700b9509 100644 --- a/oslo_cache/tests/test_cache.py +++ b/oslo_cache/tests/test_cache.py @@ -29,6 +29,8 @@ from oslo_config import fixture as config_fixture CONF = cfg.CONF NO_VALUE = api.NO_VALUE +TEST_GROUP = uuid.uuid4().hex +TEST_GROUP2 = uuid.uuid4().hex class BaseTestCase(base.BaseTestCase): @@ -109,6 +111,12 @@ class CacheRegionTest(BaseTestCase): self.config_fixture.register_opt( cfg.BoolOpt('caching', default=True), group='cache') + def _add_dummy_config_group(self): + self.config_fixture.register_opt( + cfg.IntOpt('cache_time', default=None), group=TEST_GROUP) + self.config_fixture.register_opt( + cfg.IntOpt('cache_time', default=None), group=TEST_GROUP2) + def _get_cacheable_function(self): with mock.patch.object(cache.REGION, 'cache_on_arguments', self.region.cache_on_arguments): @@ -137,7 +145,7 @@ class CacheRegionTest(BaseTestCase): self.region.cache_on_arguments): memoize = cache.get_memoization_decorator( section='cache', - expiration_section='assignment') + expiration_section=TEST_GROUP2) class _test_obj(object): def __init__(self, value): @@ -176,29 +184,31 @@ class CacheRegionTest(BaseTestCase): return _do_test def test_cache_no_fallthrough_expiration_time_fn(self): + self._add_dummy_config_group() # Since we do not re-configure the cache region, for ease of testing # this value is set the same as the expiration_time default in the # [cache] section cache_time = 600 - expiration_time = cache.get_expiration_time_fn('role') + expiration_time = cache.get_expiration_time_fn(TEST_GROUP) do_test = self._get_cache_fallthrough_fn(cache_time) - # Run the test with the assignment cache_time value + # Run the test with the dummy group cache_time value self.config_fixture.config(cache_time=cache_time, - group='role') + group=TEST_GROUP) test_value = TestProxyValue(uuid.uuid4().hex) self.assertEqual(cache_time, expiration_time()) do_test(value=test_value) def test_cache_fallthrough_expiration_time_fn(self): + self._add_dummy_config_group() # Since we do not re-configure the cache region, for ease of testing # this value is set the same as the expiration_time default in the # [cache] section cache_time = 599 - expiration_time = cache.get_expiration_time_fn('role') + expiration_time = cache.get_expiration_time_fn(TEST_GROUP) do_test = self._get_cache_fallthrough_fn(cache_time) - # Run the test with the assignment cache_time value set to None and + # Run the test with the dummy group cache_time value set to None and # the global value set. - self.config_fixture.config(cache_time=None, group='role') + self.config_fixture.config(cache_time=None, group=TEST_GROUP) test_value = TestProxyValue(uuid.uuid4().hex) self.assertIsNone(expiration_time()) do_test(value=test_value)