Revision 8716b1db test/ganeti.locking_unittest.py

b/test/ganeti.locking_unittest.py
1804 1804

  
1805 1805
  def testLockNames(self):
1806 1806
    self.assertEqual(self.GL._names(locking.LEVEL_CLUSTER), set(["BGL"]))
1807
    self.assertEqual(self.GL._names(locking.LEVEL_NODE_ALLOC), set(["NAL"]))
1807 1808
    self.assertEqual(self.GL._names(locking.LEVEL_NODE), set(self.nodes))
1808 1809
    self.assertEqual(self.GL._names(locking.LEVEL_NODEGROUP),
1809 1810
                     set(self.nodegroups))
......
1816 1817
    locking.GanetiLockManager._instance = None
1817 1818
    self.GL = locking.GanetiLockManager([], [], [], [])
1818 1819
    self.assertEqual(self.GL._names(locking.LEVEL_CLUSTER), set(["BGL"]))
1820
    self.assertEqual(self.GL._names(locking.LEVEL_NODE_ALLOC), set(["NAL"]))
1819 1821
    self.assertEqual(self.GL._names(locking.LEVEL_NODE), set())
1820 1822
    self.assertEqual(self.GL._names(locking.LEVEL_NODEGROUP), set())
1821 1823
    self.assertEqual(self.GL._names(locking.LEVEL_INSTANCE), set())
......
1824 1826
    locking.GanetiLockManager._instance = None
1825 1827
    self.GL = locking.GanetiLockManager(self.nodes, self.nodegroups, [], [])
1826 1828
    self.assertEqual(self.GL._names(locking.LEVEL_CLUSTER), set(["BGL"]))
1829
    self.assertEqual(self.GL._names(locking.LEVEL_NODE_ALLOC), set(["NAL"]))
1827 1830
    self.assertEqual(self.GL._names(locking.LEVEL_NODE), set(self.nodes))
1828 1831
    self.assertEqual(self.GL._names(locking.LEVEL_NODEGROUP),
1829 1832
                                    set(self.nodegroups))
......
1833 1836
    locking.GanetiLockManager._instance = None
1834 1837
    self.GL = locking.GanetiLockManager([], [], self.instances, [])
1835 1838
    self.assertEqual(self.GL._names(locking.LEVEL_CLUSTER), set(["BGL"]))
1839
    self.assertEqual(self.GL._names(locking.LEVEL_NODE_ALLOC), set(["NAL"]))
1836 1840
    self.assertEqual(self.GL._names(locking.LEVEL_NODE), set())
1837 1841
    self.assertEqual(self.GL._names(locking.LEVEL_NODEGROUP), set())
1838 1842
    self.assertEqual(self.GL._names(locking.LEVEL_INSTANCE),
......
1841 1845
    locking.GanetiLockManager._instance = None
1842 1846
    self.GL = locking.GanetiLockManager([], [], [], self.networks)
1843 1847
    self.assertEqual(self.GL._names(locking.LEVEL_CLUSTER), set(["BGL"]))
1848
    self.assertEqual(self.GL._names(locking.LEVEL_NODE_ALLOC), set(["NAL"]))
1844 1849
    self.assertEqual(self.GL._names(locking.LEVEL_NODE), set())
1845 1850
    self.assertEqual(self.GL._names(locking.LEVEL_NODEGROUP), set())
1846 1851
    self.assertEqual(self.GL._names(locking.LEVEL_INSTANCE), set())
......
1946 1951
  def testModifiableLevels(self):
1947 1952
    self.assertRaises(AssertionError, self.GL.add, locking.LEVEL_CLUSTER,
1948 1953
                      ["BGL2"])
1954
    self.assertRaises(AssertionError, self.GL.add, locking.LEVEL_NODE_ALLOC,
1955
                      ["NAL2"])
1949 1956
    self.GL.acquire(locking.LEVEL_CLUSTER, ["BGL"])
1950 1957
    self.GL.add(locking.LEVEL_INSTANCE, ["i4"])
1951 1958
    self.GL.remove(locking.LEVEL_INSTANCE, ["i3"])

Also available in: Unified diff