make enforce_type=True in CONF.set_override

Each config option has limitation for type and value. If we use
method CONF.set_override without parameter enforce_type=True, we
may pass wrong type to config option.

This commit makes sure calling method CONF.set_override with
enforce_type=True.

Change-Id: I1430c93777d6e5d98086a8700663ab9f58c1e5ab
Closes-Bug: #1517839
This commit is contained in:
Javeme 2016-01-07 14:59:45 +08:00
parent 91273fed79
commit ca6c34ac71
3 changed files with 5 additions and 4 deletions

View File

@ -128,7 +128,7 @@ class ConfFixture(fixtures.Fixture):
@transport_driver.setter
def transport_driver(self, value):
self.conf.set_override('rpc_backend', value)
self.conf.set_override('rpc_backend', value, enforce_type=True)
@property
def response_timeout(self):
@ -137,4 +137,5 @@ class ConfFixture(fixtures.Fixture):
@response_timeout.setter
def response_timeout(self, value):
self.conf.set_override('rpc_response_timeout', value)
self.conf.set_override('rpc_response_timeout', value,
enforce_type=True)

View File

@ -221,7 +221,7 @@ class TestCallTimeout(test_utils.BaseTestCase):
('all_none',
dict(confval=None, ctor=None, prepare=_notset, expect=None)),
('confval',
dict(confval=21.1, ctor=None, prepare=_notset, expect=21.1)),
dict(confval=21, ctor=None, prepare=_notset, expect=21)),
('ctor',
dict(confval=None, ctor=21.1, prepare=_notset, expect=21.1)),
('ctor_zero',

View File

@ -57,7 +57,7 @@ class BaseTestCase(base.BaseTestCase):
"""
group = kw.pop('group', None)
for k, v in six.iteritems(kw):
self.conf.set_override(k, v, group)
self.conf.set_override(k, v, group, enforce_type=True)
class ServerThreadHelper(threading.Thread):