Fix unit test failures in gate
due to config option enforcement by default. Some of our unit tests were setting e.g. string values for boolean config options and the tests now generate exceptions because the oslo infra is enforcing the option types. Just set the fake values to the expected types. Change-Id: If92f4010f3fd6e8f512a6537b31d9dcdcf8b513e Closes-Bug: #1689191
This commit is contained in:
parent
6a66d7b8de
commit
21f20d0a0b
@ -19,6 +19,7 @@ import ddt
|
||||
import mock
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from manila import exception
|
||||
from manila.share import configuration
|
||||
@ -82,7 +83,7 @@ class WindowsServiceInstanceManagerTestCase(test.TestCase):
|
||||
|
||||
if not use_cert_auth:
|
||||
mock_check_complexity.assert_called_once_with(
|
||||
mock.sentinel.password)
|
||||
six.text_type(mock.sentinel.password))
|
||||
|
||||
@ddt.data(False, True)
|
||||
def test_get_auth_info(self, use_cert_auth):
|
||||
@ -165,7 +166,7 @@ class WindowsServiceInstanceManagerTestCase(test.TestCase):
|
||||
expected_kwargs = dict(user_data=mock_cert_data)
|
||||
else:
|
||||
expected_kwargs = dict(
|
||||
meta=dict(admin_pass=mock.sentinel.admin_pass))
|
||||
meta=dict(admin_pass=six.text_type(mock.sentinel.admin_pass)))
|
||||
|
||||
create_kwargs = self._mgr._get_service_instance_create_kwargs()
|
||||
|
||||
|
@ -41,17 +41,17 @@ class HookBaseTestCase(test.TestCase):
|
||||
super(HookBaseTestCase, self).setUp()
|
||||
self.context = context.get_admin_context()
|
||||
self.default_config = {
|
||||
"enable_pre_hooks": "fake_enable_pre_hooks",
|
||||
"enable_post_hooks": "fake_enable_post_hooks",
|
||||
"enable_periodic_hooks": "fake_enable_periodic_hooks",
|
||||
"suppress_pre_hooks_errors": "fake_suppress_pre_hook_errors",
|
||||
"suppress_post_hooks_errors": "fake_suppress_post_hook_errors",
|
||||
"enable_pre_hooks": True,
|
||||
"enable_post_hooks": True,
|
||||
"enable_periodic_hooks": True,
|
||||
"suppress_pre_hooks_errors": True,
|
||||
"suppress_post_hooks_errors": True,
|
||||
}
|
||||
for k, v in self.default_config.items():
|
||||
hook.CONF.set_default(k, v)
|
||||
|
||||
def _fake_safe_get(self, key):
|
||||
return self.default_config.get(key) + "_safe_get"
|
||||
return self.default_config.get(key)
|
||||
|
||||
def _get_hook_instance(self, set_configuration=True, host="fake_host"):
|
||||
if set_configuration:
|
||||
|
Loading…
Reference in New Issue
Block a user