From 84152b96b322b544c3d3db6d306810b20e4d144e Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 21 Feb 2008 13:45:27 +0000 Subject: [PATCH] Add a few SharedLock delete() tests - Check that even a shared acquire() fails on a deleted lock - Check that delete() fails on a lock you share (must own it or nothing) These are assumptions I build on in future code, so better check for them. Currently no code change is necessary for them to be valid. Reviewed-by: iustinp --- test/ganeti.locking_unittest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/ganeti.locking_unittest.py b/test/ganeti.locking_unittest.py index 9e99ab17b..75d9e9475 100755 --- a/test/ganeti.locking_unittest.py +++ b/test/ganeti.locking_unittest.py @@ -192,8 +192,13 @@ class TestSharedLock(unittest.TestCase): def testDelete(self): self.sl.delete() self.assertRaises(errors.LockError, self.sl.acquire) + self.assertRaises(errors.LockError, self.sl.acquire, shared=1) self.assertRaises(errors.LockError, self.sl.delete) + def testNoDeleteIfSharer(self): + self.sl.acquire(shared=1) + self.assertRaises(AssertionError, self.sl.delete) + def testDeletePendingSharersExclusiveDelete(self): self.sl.acquire() Thread(target=self._doItSharer).start() -- GitLab