From 21f20d0a0b419aa65e27360d8d9ecefc2320e869 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Sun, 7 May 2017 14:50:01 -0400 Subject: [PATCH] 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 --- .../share/drivers/windows/test_service_instance.py | 5 +++-- manila/tests/share/test_hook.py | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manila/tests/share/drivers/windows/test_service_instance.py b/manila/tests/share/drivers/windows/test_service_instance.py index 7c359e0346..17113c5044 100644 --- a/manila/tests/share/drivers/windows/test_service_instance.py +++ b/manila/tests/share/drivers/windows/test_service_instance.py @@ -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() diff --git a/manila/tests/share/test_hook.py b/manila/tests/share/test_hook.py index 1d3dceadeb..d136f63cfa 100644 --- a/manila/tests/share/test_hook.py +++ b/manila/tests/share/test_hook.py @@ -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: