From 90c942d1c67cbb314443bc9ffc706e3768391f66 Mon Sep 17 00:00:00 2001 From: Guido Trotter Date: Mon, 18 Aug 2008 12:50:41 +0000 Subject: [PATCH] Add lock-all-through-GLM unit test I was hunting for a bug in my code and thought the culprit was in the locking library, so I added a test to check. Unfortunately turns out it wasn't. :( Committing the test anyway, while still trying to figure out what's wrong... Reviewed-by: imsnah --- test/ganeti.locking_unittest.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/ganeti.locking_unittest.py b/test/ganeti.locking_unittest.py index 9da1303..a2d4f6e 100755 --- a/test/ganeti.locking_unittest.py +++ b/test/ganeti.locking_unittest.py @@ -635,6 +635,20 @@ class TestGanetiLockManager(unittest.TestCase): self.GL.acquire(locking.LEVEL_INSTANCE, ['i3'], shared=1) self.assertEquals(self.GL._list_owned(locking.LEVEL_INSTANCE), set(['i3'])) + def testAcquireWholeSets(self): + self.GL.acquire(locking.LEVEL_CLUSTER, ['BGL'], shared=1) + self.assertEquals(self.GL.acquire(locking.LEVEL_INSTANCE, None), + set(self.instances)) + self.assertEquals(self.GL._list_owned(locking.LEVEL_INSTANCE), + set(self.instances)) + self.assertEquals(self.GL.acquire(locking.LEVEL_NODE, None, shared=1), + set(self.nodes)) + self.assertEquals(self.GL._list_owned(locking.LEVEL_NODE), + set(self.nodes)) + self.GL.release(locking.LEVEL_NODE) + self.GL.release(locking.LEVEL_INSTANCE) + self.GL.release(locking.LEVEL_CLUSTER) + def testBGLDependency(self): self.assertRaises(AssertionError, self.GL.acquire, locking.LEVEL_NODE, ['n1', 'n2']) -- 1.7.10.4