Permalink
Browse files

Set lock_path to a tempdir in TestLockCleanup

Fixes bug #945363

Change-Id: I2e2b81eebbfce0c10e431041f6b9d45bcf26f1c0
  • Loading branch information...
1 parent 0193d12 commit 98fe2b504bfcebb57fee621346a37e1f48fbacaa @hudayou hudayou committed Mar 2, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 nova/tests/test_utils.py
View
@@ -20,6 +20,7 @@
import os
import os.path
import socket
+import shutil
import StringIO
import tempfile
@@ -828,6 +829,8 @@ def setUp(self):
self.pid = os.getpid()
self.dead_pid = self._get_dead_pid()
+ self.tempdir = tempfile.mkdtemp()
+ self.flags(lock_path=self.tempdir)
self.lock_name = 'nova-testlock'
self.lock_file = os.path.join(FLAGS.lock_path,
self.lock_name + '.lock')
@@ -839,6 +842,10 @@ def setUp(self):
if errno == 2:
pass
+ def tearDown(self):
+ shutil.rmtree(self.tempdir)
+ super(TestLockCleanup, self).tearDown()
+
def _get_dead_pid(self):
"""get a pid for a process that does not exist"""

0 comments on commit 98fe2b5

Please sign in to comment.