diff options
| author | Hengqing Hu <hudayou@hotmail.com> | 2012-03-02 22:32:05 +0800 |
|---|---|---|
| committer | Hengqing Hu <hudayou@hotmail.com> | 2012-03-08 19:07:30 +0800 |
| commit | 98fe2b504bfcebb57fee621346a37e1f48fbacaa (patch) | |
| tree | 5e318bbafc8d4a508194cbb5db3c9ed5de11eb97 | |
| parent | 0193d1253c48c719b7f10bb19505ebb4b52defd3 (diff) | |
| download | nova-98fe2b504bfcebb57fee621346a37e1f48fbacaa.tar.gz nova-98fe2b504bfcebb57fee621346a37e1f48fbacaa.tar.xz nova-98fe2b504bfcebb57fee621346a37e1f48fbacaa.zip | |
Set lock_path to a tempdir in TestLockCleanup
Fixes bug #945363
Change-Id: I2e2b81eebbfce0c10e431041f6b9d45bcf26f1c0
| -rw-r--r-- | nova/tests/test_utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/tests/test_utils.py b/nova/tests/test_utils.py index 15b618d8e..a220bf336 100644 --- a/nova/tests/test_utils.py +++ b/nova/tests/test_utils.py @@ -20,6 +20,7 @@ import hashlib import os import os.path import socket +import shutil import StringIO import tempfile @@ -828,6 +829,8 @@ class TestLockCleanup(test.TestCase): 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 @@ class TestLockCleanup(test.TestCase): 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""" |
