Fix the broken UT of huawei driver for py34/35
The cause of failing unit tests is a bug in huawei driver. When huawei driver logins to backend, it reads username/password from huawei configuration file. If the username/password are configured as plain text, huawei driver'll encode them and overwrite the encoded text to the configuration file. The encoding logic code is like this: six.text_type(base64.b64encode("***")) For py27, this code works fine. However, for py34, this text_type converting adds some extra words to result unicode string, like "b'***'"('***' is the actual encoded result string). Once driver reads the username/password again, it'll get the incorrect text and then fail while jsonutils.dumps. All the failed unit tests tried to call login twice, and triggered the error condition said above. This patch is just a workaround, because those failed tests actually no need to login twice, the redundant login calls are removed. Another patch will be commited to fix the problem thoroughly in huawei driver. Bug https://launchpad.net/bugs/1612149 has been raised for that work, and will also analyze what changed to trigger this issue only recently. Change-Id: Ia6bf7bbb9ffb9644085bbdf4f5576f09215a877f Closes-Bug: #1612149
This commit is contained in:
parent
e7f62b11ef
commit
5ea4911794
@ -2815,9 +2815,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||
self.mock_object(db,
|
||||
'share_type_get',
|
||||
mock.Mock(return_value=share_type))
|
||||
self.driver.plugin.configuration.manila_huawei_conf_file = (
|
||||
self.fake_conf_file)
|
||||
self.driver.plugin.helper.login()
|
||||
|
||||
self.assertRaises(exception.InvalidInput,
|
||||
self.driver.manage_existing,
|
||||
share,
|
||||
@ -2831,9 +2829,7 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||
self.mock_object(db,
|
||||
'share_type_get',
|
||||
mock.Mock(return_value=share_type))
|
||||
self.driver.plugin.configuration.manila_huawei_conf_file = (
|
||||
self.fake_conf_file)
|
||||
self.driver.plugin.helper.login()
|
||||
|
||||
self.assertRaises(exception.InvalidHost,
|
||||
self.driver.manage_existing,
|
||||
share,
|
||||
@ -3074,7 +3070,6 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||
self.recreate_fake_conf_file(multi_url=True)
|
||||
self.driver.plugin.configuration.manila_huawei_conf_file = (
|
||||
self.fake_conf_file)
|
||||
self.driver.plugin.helper.login()
|
||||
self.driver.plugin.helper.test_multi_url_flag = 2
|
||||
location = self.driver.create_share(self._context, self.share_nfs,
|
||||
self.share_server)
|
||||
@ -3084,7 +3079,6 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||
self.recreate_fake_conf_file(multi_url=True)
|
||||
self.driver.plugin.configuration.manila_huawei_conf_file = (
|
||||
self.fake_conf_file)
|
||||
self.driver.plugin.helper.login()
|
||||
self.driver.plugin.helper.test_multi_url_flag = 1
|
||||
self.assertRaises(exception.InvalidShare,
|
||||
self.driver.create_share,
|
||||
@ -3716,7 +3710,6 @@ class HuaweiShareDriverTestCase(test.TestCase):
|
||||
backend_details = self.driver.setup_server(self.fake_network_info)
|
||||
fake_share_server = {'backend_details': backend_details}
|
||||
|
||||
self.driver.plugin.helper.login()
|
||||
location = self.driver.ensure_share(self._context,
|
||||
share,
|
||||
fake_share_server)
|
||||
|
Loading…
Reference in New Issue
Block a user