Commit 4badc36c authored by Guido Trotter's avatar Guido Trotter
Browse files

Add test for modifiable locking levels

Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarMichael Hanselmann <>
parent f5d723fe
......@@ -1535,6 +1535,20 @@ class TestGanetiLockManager(_ThreadedTestCase):
self.assertRaises(AssertionError, self.GL.acquire,
locking.LEVEL_INSTANCE, ['i2'])
def testModifiableLevels(self):
self.assertRaises(AssertionError, self.GL.add, locking.LEVEL_CLUSTER,
self.GL.acquire(locking.LEVEL_CLUSTER, ['BGL'])
self.GL.add(locking.LEVEL_INSTANCE, ['i4'])
self.GL.remove(locking.LEVEL_INSTANCE, ['i3'])
self.GL.remove(locking.LEVEL_INSTANCE, ['i1'])
self.assertEqual(self.GL._names(locking.LEVEL_INSTANCE), set(['i2', 'i4']))
self.GL.add(locking.LEVEL_NODE, ['n3'])
self.GL.remove(locking.LEVEL_NODE, ['n1'])
self.assertEqual(self.GL._names(locking.LEVEL_NODE), set(['n2', 'n3']))
self.assertRaises(AssertionError, self.GL.remove, locking.LEVEL_CLUSTER,
# Helper function to run as a thread that shared the BGL and then acquires
# some locks at another level.
def _doLock(self, level, names, shared):
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