Skip to content

Commit

Permalink
Set lock_path to a tempdir in TestLockCleanup
Browse files Browse the repository at this point in the history
Fixes bug #945363

Change-Id: I2e2b81eebbfce0c10e431041f6b9d45bcf26f1c0
  • Loading branch information
hudayou committed Mar 8, 2012
1 parent 0193d12 commit 98fe2b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nova/tests/test_utils.py
Expand Up @@ -20,6 +20,7 @@
import os
import os.path
import socket
import shutil
import StringIO
import tempfile

Expand Down Expand Up @@ -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')
Expand All @@ -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"""

Expand Down

0 comments on commit 98fe2b5

Please sign in to comment.