From 6bae6c573468725825be6ea854558a6392dbe263 Mon Sep 17 00:00:00 2001 From: Chuck Fouts Date: Sat, 27 Feb 2016 13:46:59 -0500 Subject: [PATCH] NetApp: Fix SSH Client File Creation in Unit Test A bug was introduced where ssh_known_hosts file is created when the unit tests in test_netapp.py are run. This patch adds mocks to the ssh init calls to prevent this file creation. Change-Id: Ie8ac4e7a5236e6735c7c2f4f50c5383f5f23d38e Closes-bug: #1550542 --- cinder/tests/unit/test_netapp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cinder/tests/unit/test_netapp.py b/cinder/tests/unit/test_netapp.py index bfaca9e6c..ee2ea3278 100644 --- a/cinder/tests/unit/test_netapp.py +++ b/cinder/tests/unit/test_netapp.py @@ -571,6 +571,7 @@ class NetAppDirectCmodeISCSIDriverTestCase(test.TestCase): lambda a, b, c, synchronous: None) self.mock_object(utils, 'OpenStackInfo') self.mock_object(perf_7mode, 'Performance7modeLibrary') + self.mock_object(client_base.Client, '_init_ssh_client') configuration = self._set_config(create_configuration()) driver = common.NetAppDriver(configuration=configuration) @@ -1270,6 +1271,7 @@ class NetAppDirect7modeISCSIDriverTestCase_NV(test.TestCase): configuration = self._set_config(create_configuration()) driver = common.NetAppDriver(configuration=configuration) + self.mock_object(client_base.Client, '_init_ssh_client') self.stubs.Set(http_client, 'HTTPConnection', FakeDirect7modeHTTPConnection) self.mock_object(driver.library, '_get_root_volume_name', mock.Mock( @@ -1331,6 +1333,7 @@ class NetAppDirect7modeISCSIDriverTestCase_WV( configuration = self._set_config(create_configuration()) driver = common.NetAppDriver(configuration=configuration) + self.mock_object(client_base.Client, '_init_ssh_client') self.stubs.Set(http_client, 'HTTPConnection', FakeDirect7modeHTTPConnection) self.mock_object(driver.library, '_get_root_volume_name', -- 2.45.2