The unit test test_windows was setting and creating
a directory c://iSCSIVirtualDisks in the root path
and even worse wasn't deleting it on cleanup.
This patch converts that to use tempfile and also
adds an shutil.rmtree to the teardown method to clean
up all the junk it creates.
Fixes bug:
1219950
Change-Id: Ibd071c9c3ae9a02f26c85a09e8bc6619d8c73a37
import os
+import shutil
+import tempfile
from oslo.config import cfg
super(TestWindowsDriver, self).__init__(method)
def setUp(self):
+ self.lun_path_tempdir = tempfile.mkdtemp()
super(TestWindowsDriver, self).setUp()
self._mox = mox_lib.Mox()
self.stubs = stubout.StubOutForTesting()
self.flags(
- windows_iscsi_lun_path='C:\iSCSIVirtualDisks',
+ windows_iscsi_lun_path=self.lun_path_tempdir,
)
self._setup_stubs()
configuration = conf.Configuration(None)
def tearDown(self):
self._mox.UnsetStubs()
self.stubs.UnsetAll()
+ shutil.rmtree(self.lun_path_tempdir)
super(TestWindowsDriver, self).tearDown()
def _setup_stubs(self):