Fix unit tests for oslo.config 4.0

oslo.config 4.0 will check overridden value type by default[1],
which exposes a couple issues in Ironic:

- default_storage_interface is defined as ListOpt, when it should be
  StrOpt.

- test_get_client_with_endpoint_override sets an invalid url for config
  option url, which fails when checked by oslo.config.

[1] https://review.openstack.org/#/c/328692

Change-Id: Id166da73a41c8c46d9f3e239579d0cafb93bf69f
Closes-Bug: #1517839
This commit is contained in:
Javier Pena 2017-04-18 14:10:22 +02:00
parent 19ced862a7
commit f64154482f
3 changed files with 17 additions and 7 deletions

View File

@ -243,7 +243,7 @@
# have storage_interface field set. A complete list of storage
# interfaces present on your system may be found by
# enumerating the "ironic.hardware.interfaces.storage"
# entrypoint. (list value)
# entrypoint. (string value)
#default_storage_interface = <None>
# Specify the list of vendor interfaces to load during service
@ -2564,10 +2564,20 @@
# value)
#sasl_config_name =
# User name for message broker authentication (string value)
# DEPRECATED: User name for message broker authentication
# (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
# Reason: Should use configuration option transport_url to
# provide the username.
#username =
# Password for message broker authentication (string value)
# DEPRECATED: Password for message broker authentication
# (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
# Reason: Should use configuration option transport_url to
# provide the password.
#password =
# Seconds to pause before attempting to re-connect. (integer

View File

@ -137,8 +137,8 @@ driver_opts = [
cfg.ListOpt('enabled_storage_interfaces',
default=['noop'],
help=_ENABLED_IFACE_HELP.format('storage')),
cfg.ListOpt('default_storage_interface',
help=_DEFAULT_IFACE_HELP.format('storage')),
cfg.StrOpt('default_storage_interface',
help=_DEFAULT_IFACE_HELP.format('storage')),
cfg.ListOpt('enabled_vendor_interfaces',
default=['no-vendor'],
help=_ENABLED_IFACE_HELP.format('vendor')),

View File

@ -72,10 +72,10 @@ class TestCinderClient(base.TestCase):
def test_get_client_with_endpoint_override(
self, mock_client_init, mock_session):
self.config(url='test-url', group='cinder')
self.config(url='http://test-url', group='cinder')
mock_session_obj = mock.Mock()
expected = {'connect_retries': 2,
'endpoint_override': 'test-url',
'endpoint_override': 'http://test-url',
'session': mock_session_obj}
mock_session.return_value = mock_session_obj
mock_client_init.return_value = None