os.path.exists should be mocked in test case
This commit mocks os.path.exists in the test case test_start_iscsi_target_fail_wait_daemon in extensions.iscsi.TestISCSIExtension. If this isn't mocked, the file can coincidentally exist on the environment and can cause failure. Change-Id: Ibaa8fcae51faaaefc2764411d02621f347d99c03
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import os
|
||||
import time
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
@@ -64,6 +65,7 @@ class TestISCSIExtension(test_base.BaseTestCase):
|
||||
self.assertEqual({'iscsi_target_iqn': self.fake_iqn},
|
||||
result.command_result)
|
||||
|
||||
@mock.patch.object(os.path, 'exists', lambda x: False)
|
||||
def test_start_iscsi_target_fail_wait_daemon(self, mock_execute,
|
||||
mock_dispatch):
|
||||
mock_dispatch.return_value = self.fake_dev
|
||||
|
||||
Reference in New Issue
Block a user