Merge "Fix driver mode opt definition"

This commit is contained in:
Jenkins 2014-12-18 19:03:04 +00:00 committed by Gerrit Code Review
commit a7d71c2991
2 changed files with 17 additions and 1 deletions

View File

@ -53,7 +53,7 @@ share_opts = [
"If not set, the share backend's config group will be used."
"If an option is not found within provided group, then"
"'DEFAULT' group will be used for search of option."),
cfg.ListOpt(
cfg.StrOpt(
'share_driver_mode',
default=None,
help="One specific mode for driver to use. Available values: "

View File

@ -15,6 +15,7 @@
# under the License.
"""Unit tests for the Share driver module."""
import os
import time
import mock
@ -55,6 +56,21 @@ class ShareDriverTestCase(test.TestCase):
self.assertRaises(exception.ProcessExecutionError,
execute_mixin._try_execute)
def test_verify_share_driver_mode_option_type(self):
with utils.tempdir() as tmpdir:
tmpfilename = os.path.join(tmpdir, 'share_driver_mode.conf')
with open(tmpfilename, "w") as configfile:
configfile.write("""[DEFAULT]\nshare_driver_mode = fake""")
# Add config file with updated opt
driver.CONF.default_config_files = [configfile.name]
# Reload config instance to use redefined opt
driver.CONF.reload_config_files()
share_driver = driver.ShareDriver()
self.assertEqual('fake', share_driver.mode)
def _instantiate_share_driver(self, network_config_group):
self.stubs.Set(network, 'API', mock.Mock())
config = mock.Mock()