Support older notifications set_override keys
Neutron and Ceilometer use set_override to set the older deprecated key. We should support them using the ConfFixture Closes-Bug: #1521776 Change-Id: I2bd77284f80bc4525f062f313b1ec74f2b54b395
This commit is contained in:
committed by
Oleksii Zamiatin
parent
ba42571b5a
commit
b6ad95e1ca
@@ -18,6 +18,7 @@ __all__ = ['ConfFixture']
|
||||
import sys
|
||||
|
||||
import fixtures
|
||||
from functools import wraps
|
||||
|
||||
|
||||
def _import_opts(conf, module, opts, group=None):
|
||||
@@ -70,6 +71,24 @@ class ConfFixture(fixtures.Fixture):
|
||||
'_notifier_opts',
|
||||
'oslo_messaging_notifications')
|
||||
|
||||
# Support older test cases that still use the set_override
|
||||
# with the old config key names
|
||||
def decorator_for_set_override(wrapped_function):
|
||||
@wraps(wrapped_function)
|
||||
def _wrapper(*args, **kwargs):
|
||||
group = 'oslo_messaging_notifications'
|
||||
if args[0] == 'notification_driver':
|
||||
args = ('driver', args[1], group)
|
||||
elif args[0] == 'notification_transport_url':
|
||||
args = ('transport_url', args[1], group)
|
||||
elif args[0] == 'notification_topics':
|
||||
args = ('topics', args[1], group)
|
||||
return wrapped_function(*args, **kwargs)
|
||||
return _wrapper
|
||||
|
||||
self.conf.set_override = decorator_for_set_override(
|
||||
self.conf.set_override)
|
||||
|
||||
def setUp(self):
|
||||
super(ConfFixture, self).setUp()
|
||||
self.addCleanup(self.conf.reset)
|
||||
|
||||
Reference in New Issue
Block a user