Remove usage of parameter enforce_type
oslo.config has deprecated the enforce_type parameter to set_override() and set its default value to True [1], so remove this usage from our codebase. Also remove explict str() cast of mock.sentinel_password in Windows driver since it should no longer be expected. [1] Ifa552de0a994e40388cbc9f7dbaa55700ca276b0 Change-Id: Ic02cbb37c6dbf30cacb1e6e290bfb0986f54d5f3
This commit is contained in:
parent
9dad416b36
commit
4e25ce5a0c
@ -181,7 +181,7 @@ class TestCase(base_test.BaseTestCase):
|
||||
def flags(self, **kw):
|
||||
"""Override flag variables for a test."""
|
||||
for k, v in kw.items():
|
||||
CONF.set_override(k, v, enforce_type=True)
|
||||
CONF.set_override(k, v)
|
||||
|
||||
def start_service(self, name, host=None, **kwargs):
|
||||
host = host and host or uuidutils.generate_uuid()
|
||||
|
@ -260,7 +260,7 @@ class ManilaCmdManageTestCase(test.TestCase):
|
||||
@mock.patch('six.moves.builtins.open')
|
||||
@mock.patch('os.listdir')
|
||||
def test_get_log_commands_errors(self, listdir, open):
|
||||
CONF.set_override('log_dir', 'fake-dir', enforce_type=True)
|
||||
CONF.set_override('log_dir', 'fake-dir')
|
||||
listdir.return_value = ['fake-error.log']
|
||||
|
||||
with mock.patch('sys.stdout', new=six.StringIO()) as fake_out:
|
||||
|
@ -39,9 +39,8 @@ class ManilaCmdShareTestCase(test.TestCase):
|
||||
self.mock_object(self.launcher, 'wait')
|
||||
self.server = manila_share.service.Service.create.return_value
|
||||
fake_host = 'fake.host'
|
||||
CONF.set_override('enabled_share_backends', backends,
|
||||
enforce_type=True)
|
||||
CONF.set_override('host', fake_host, enforce_type=True)
|
||||
CONF.set_override('enabled_share_backends', backends)
|
||||
CONF.set_override('host', fake_host)
|
||||
sys.argv = ['manila-share']
|
||||
|
||||
manila_share.main()
|
||||
|
@ -427,8 +427,7 @@ class CephFSNativeDriverTestCase(test.TestCase):
|
||||
def test_connect_noevict(self):
|
||||
# When acting as "admin", driver should skip evicting
|
||||
self._driver.configuration.local_conf.set_override('cephfs_auth_id',
|
||||
"admin",
|
||||
enforce_type=True)
|
||||
"admin")
|
||||
|
||||
self._driver.create_share(self._context,
|
||||
self._share)
|
||||
|
@ -53,17 +53,17 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
|
||||
self.config.append_config_values(na_opts.netapp_provisioning_opts)
|
||||
self.config.append_config_values(na_opts.netapp_data_motion_opts)
|
||||
CONF.set_override("share_backend_name", self.backend,
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
CONF.set_override("netapp_transport_type", "https",
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
CONF.set_override("netapp_login", "fake_user",
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
CONF.set_override("netapp_password", "fake_password",
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
CONF.set_override("netapp_server_hostname", "fake.hostname",
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
CONF.set_override("netapp_server_port", 8866,
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
|
||||
def test_get_client_for_backend(self):
|
||||
self.mock_object(data_motion, "get_backend_configuration",
|
||||
@ -81,7 +81,7 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
|
||||
mock.Mock(return_value=self.config))
|
||||
|
||||
CONF.set_override("netapp_vserver", 'fake_vserver',
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
|
||||
data_motion.get_client_for_backend(self.backend)
|
||||
|
||||
@ -93,7 +93,7 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
|
||||
def test_get_config_for_backend(self):
|
||||
self.mock_object(data_motion, "CONF")
|
||||
CONF.set_override("netapp_vserver", 'fake_vserver',
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
data_motion.CONF.list_all_sections.return_value = [self.backend]
|
||||
|
||||
config = data_motion.get_backend_configuration(self.backend)
|
||||
@ -103,9 +103,9 @@ class NetAppCDOTDataMotionTestCase(test.TestCase):
|
||||
def test_get_config_for_backend_different_backend_name(self):
|
||||
self.mock_object(data_motion, "CONF")
|
||||
CONF.set_override("netapp_vserver", 'fake_vserver',
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
CONF.set_override("share_backend_name", "fake_backend_name",
|
||||
group=self.backend, enforce_type=True)
|
||||
group=self.backend)
|
||||
data_motion.CONF.list_all_sections.return_value = [self.backend]
|
||||
|
||||
config = data_motion.get_backend_configuration(self.backend)
|
||||
|
@ -1183,8 +1183,7 @@ EXPANDED_PROCESSOR_COUNTERS = [
|
||||
|
||||
def get_config_cmode():
|
||||
config = na_fakes.create_configuration_cmode()
|
||||
config.local_conf.set_override('share_backend_name', BACKEND_NAME,
|
||||
enforce_type=True)
|
||||
config.local_conf.set_override('share_backend_name', BACKEND_NAME)
|
||||
config.reserved_share_percentage = 5
|
||||
config.netapp_login = CLIENT_KWARGS['username']
|
||||
config.netapp_password = CLIENT_KWARGS['password']
|
||||
|
@ -120,8 +120,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
|
||||
|
||||
config = na_fakes.create_configuration()
|
||||
config.local_conf.set_override('driver_handles_share_servers',
|
||||
mode == na_common.MULTI_SVM,
|
||||
enforce_type=True)
|
||||
mode == na_common.MULTI_SVM)
|
||||
kwargs = {
|
||||
'configuration': config,
|
||||
'private_storage': mock.Mock(),
|
||||
@ -136,8 +135,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
|
||||
def test_create_driver_case_insensitive(self):
|
||||
|
||||
config = na_fakes.create_configuration()
|
||||
config.local_conf.set_override('driver_handles_share_servers', True,
|
||||
enforce_type=True)
|
||||
config.local_conf.set_override('driver_handles_share_servers', True)
|
||||
|
||||
kwargs = {
|
||||
'configuration': config,
|
||||
|
@ -82,7 +82,7 @@ class WindowsServiceInstanceManagerTestCase(test.TestCase):
|
||||
|
||||
if not use_cert_auth:
|
||||
mock_check_complexity.assert_called_once_with(
|
||||
str(mock.sentinel.password))
|
||||
mock.sentinel.password)
|
||||
|
||||
@ddt.data(False, True)
|
||||
def test_get_auth_info(self, use_cert_auth):
|
||||
@ -165,7 +165,7 @@ class WindowsServiceInstanceManagerTestCase(test.TestCase):
|
||||
expected_kwargs = dict(user_data=mock_cert_data)
|
||||
else:
|
||||
expected_kwargs = dict(
|
||||
meta=dict(admin_pass=str(mock.sentinel.admin_pass)))
|
||||
meta=dict(admin_pass=mock.sentinel.admin_pass))
|
||||
|
||||
create_kwargs = self._mgr._get_service_instance_create_kwargs()
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ConfigTestCase(test.TestCase):
|
||||
self.assertEqual(42, CONF.answer)
|
||||
|
||||
# Make sure we don't overwrite anything
|
||||
CONF.set_override('answer', 256, enforce_type=True)
|
||||
CONF.set_override('answer', 256)
|
||||
self.assertEqual(256, CONF.answer)
|
||||
CONF.import_opt('answer', 'manila.tests.declare_conf')
|
||||
self.assertEqual(256, CONF.answer)
|
||||
|
@ -41,8 +41,7 @@ class PolicyFileTestCase(test.TestCase):
|
||||
def test_modified_policy_reloads(self):
|
||||
with utils.tempdir() as tmpdir:
|
||||
tmpfilename = os.path.join(tmpdir, 'policy')
|
||||
CONF.set_override('policy_file', tmpfilename, group='oslo_policy',
|
||||
enforce_type=True)
|
||||
CONF.set_override('policy_file', tmpfilename, group='oslo_policy')
|
||||
action = "example:test"
|
||||
with open(tmpfilename, "w") as policyfile:
|
||||
policyfile.write("""{"example:test": []}""")
|
||||
|
@ -190,8 +190,7 @@ class CinderApiTestCase(test.TestCase):
|
||||
volume['attach_status'] = "detached"
|
||||
instance = {'availability_zone': 'zone1'}
|
||||
volume['availability_zone'] = 'zone2'
|
||||
cinder.CONF.set_override('cross_az_attach', False, 'cinder',
|
||||
enforce_type=True)
|
||||
cinder.CONF.set_override('cross_az_attach', False, 'cinder')
|
||||
self.assertRaises(exception.InvalidVolume,
|
||||
self.api.check_attach, self.ctx, volume, instance)
|
||||
volume['availability_zone'] = 'zone1'
|
||||
@ -203,8 +202,7 @@ class CinderApiTestCase(test.TestCase):
|
||||
volume['attach_status'] = "detached"
|
||||
volume['availability_zone'] = 'zone1'
|
||||
instance = {'availability_zone': 'zone1'}
|
||||
cinder.CONF.set_override('cross_az_attach', False, 'cinder',
|
||||
enforce_type=True)
|
||||
cinder.CONF.set_override('cross_az_attach', False, 'cinder')
|
||||
self.assertIsNone(self.api.check_attach(self.ctx, volume, instance))
|
||||
cinder.CONF.reset()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user