]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
NetApp: Fix SSH Client File Creation in Unit Test
authorChuck Fouts <fchuck@netapp.com>
Sat, 27 Feb 2016 18:46:59 +0000 (13:46 -0500)
committerChuck Fouts <fchuck@netapp.com>
Sat, 27 Feb 2016 18:46:59 +0000 (13:46 -0500)
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

index bfaca9e6c486f09c7786437c678ff92c7282fff6..ee2ea3278975ac94b01fe9ffb3c469785f82d9c4 100644 (file)
@@ -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',