Change in vdsm[master]: tests: Use testrunner.TEMPDIR

nsoffer at redhat.com nsoffer at redhat.com
Thu May 8 09:06:34 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: tests: Use testrunner.TEMPDIR
......................................................................

tests: Use testrunner.TEMPDIR

Storage functional tests used to define their own temporary directory
path. Use now the testrunner default.

Change-Id: Ib3a8047ef0f5d4fdccf79b5000b5385f371f4db8
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M tests/functional/storageTests.py
1 file changed, 5 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/27503/1

diff --git a/tests/functional/storageTests.py b/tests/functional/storageTests.py
index fe56939..80ba312 100644
--- a/tests/functional/storageTests.py
+++ b/tests/functional/storageTests.py
@@ -31,6 +31,7 @@
 
 from testrunner import VdsmTestCase as TestCaseBase
 from testrunner import permutations, expandPermutations
+from testrunner import TEMPDIR
 try:
     import rtslib
 except ImportError:
@@ -48,8 +49,6 @@
 from vdsm import vdscli
 
 from virt import vmstatus
-
-_VARTMP = '/var/tmp'
 
 if not config.getboolean('vars', 'xmlrpc_enable'):
     raise SkipTest("XML-RPC Bindings are disabled")
@@ -340,7 +339,7 @@
         uid = pwd.getpwnam(VDSM_USER)[2]
         gid = grp.getgrnam(VDSM_GROUP)[2]
 
-        rootDir = tempfile.mkdtemp(prefix='localfs', dir=_VARTMP)
+        rootDir = tempfile.mkdtemp(prefix='localfs', dir=TEMPDIR)
         undo = lambda: os.rmdir(rootDir)
         rollback.prependDefer(undo)
         os.chown(rootDir, uid, gid)
@@ -426,7 +425,7 @@
         connections = {}
         self.vgNames = {}
         for uuid, conn in backends.iteritems():
-            fd, imgPath = tempfile.mkstemp(dir=_VARTMP)
+            fd, imgPath = tempfile.mkstemp(dir=TEMPDIR)
             rollback.prependDefer(partial(os.unlink, imgPath))
             rollback.prependDefer(partial(os.close, fd))
             # Create a 10GB empty disk image
@@ -556,12 +555,12 @@
     def _createBackend(self, backends, rollback):
         prefix = 'vdsmFunctionalTestNfs'
 
-        cleanNFSLeftovers(os.path.join(_VARTMP, prefix))
+        cleanNFSLeftovers(os.path.join(TEMPDIR, prefix))
 
         uid = pwd.getpwnam(VDSM_USER)[2]
         gid = grp.getgrnam(VDSM_GROUP)[2]
 
-        rootDir = tempfile.mkdtemp(prefix=prefix, dir=_VARTMP)
+        rootDir = tempfile.mkdtemp(prefix=prefix, dir=TEMPDIR)
         undo = lambda: os.rmdir(rootDir)
         rollback.prependDefer(undo)
         os.chown(rootDir, uid, gid)


-- 
To view, visit http://gerrit.ovirt.org/27503
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3a8047ef0f5d4fdccf79b5000b5385f371f4db8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list