summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2013-03-22 10:33:57 +0000
committerMark McLoughlin <markmc@redhat.com>2013-03-22 10:33:57 +0000
commit723ad7719a21751d8f9fe72787d7713eae58cade (patch)
treef0328069541b6e64f4cc999bacaefb2318e19d73
parentf689e1cb5cfe9b43b3e2fec0e28b1ce80a0cccae (diff)
downloadoslo-723ad7719a21751d8f9fe72787d7713eae58cade.tar.gz
oslo-723ad7719a21751d8f9fe72787d7713eae58cade.tar.xz
oslo-723ad7719a21751d8f9fe72787d7713eae58cade.zip
lockutils: add a failing unit test
Add a unit test which fails because of #1107950 - in this case, lockutils is deleting the lock directory every time the lock is dropped even though another process might have acquired a lock using that directory. Change-Id: Ic82409f9462e570bc102ab469334c53aafc6d7ac
-rw-r--r--tests/unit/test_lockutils.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/unit/test_lockutils.py b/tests/unit/test_lockutils.py
index e1f0375..ae5dca7 100644
--- a/tests/unit/test_lockutils.py
+++ b/tests/unit/test_lockutils.py
@@ -125,10 +125,8 @@ class LockTestCase(utils.BaseTestCase):
if os.path.exists(tempdir):
shutil.rmtree(tempdir)
- def test_synchronized_externally(self):
+ def _do_test_synchronized_externally(self):
"""We can lock across multiple processes"""
- lock_dir = tempfile.mkdtemp()
- self.config(lock_path=lock_dir)
@lockutils.synchronized('external', 'test-', external=True)
def lock_files(handles_dir):
@@ -176,5 +174,26 @@ class LockTestCase(utils.BaseTestCase):
finally:
if os.path.exists(handles_dir):
shutil.rmtree(handles_dir, ignore_errors=True)
+
+ def test_synchronized_externally(self):
+ lock_dir = tempfile.mkdtemp()
+ self.config(lock_path=lock_dir)
+
+ try:
+ self._do_test_synchronized_externally()
+ finally:
+ if os.path.exists(lock_dir):
+ shutil.rmtree(lock_dir, ignore_errors=True)
+
+ def test_synchronized_externally_lock_dir_not_exist(self):
+ self.skipTest('bug #1107950')
+
+ lock_dir = tempfile.mkdtemp()
+ os.rmdir(lock_dir)
+ self.config(lock_path=lock_dir)
+
+ try:
+ self._do_test_synchronized_externally()
+ finally:
if os.path.exists(lock_dir):
shutil.rmtree(lock_dir, ignore_errors=True)