Commit 90c942d1 authored by Guido Trotter's avatar Guido Trotter
Browse files

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
parent 34ca3914
......@@ -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'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment