ganeti-cleaner: Remove expired X509 certs
[ganeti-local] / test / ganeti.config_unittest.py
index 64210d9..a57a3b7 100755 (executable)
@@ -36,6 +36,8 @@ from ganeti import errors
 from ganeti import objects
 from ganeti import utils
 
+import testutils
+
 
 class TestConfigRunner(unittest.TestCase):
   """Testing case for HooksRunner"""
@@ -74,6 +76,7 @@ class TestConfigRunner(unittest.TestCase):
       master_netdev=constants.DEFAULT_BRIDGE,
       cluster_name="cluster.local",
       file_storage_dir="/tmp",
+      uid_pool=[],
       )
 
     master_node_config = objects.Node(name=me.name,
@@ -108,15 +111,15 @@ class TestConfigRunner(unittest.TestCase):
     # construct a fake cluster object
     fake_cl = objects.Cluster()
     # fail if we didn't read the config
-    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_cl)
+    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_cl, None)
 
     cl = cfg.GetClusterInfo()
     # first pass, must not fail
-    cfg.Update(cl)
+    cfg.Update(cl, None)
     # second pass, also must not fail (after the config has been written)
-    cfg.Update(cl)
+    cfg.Update(cl, None)
     # but the fake_cl update should still fail
-    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_cl)
+    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_cl, None)
 
   def testUpdateNode(self):
     """Test updates on one node object"""
@@ -124,15 +127,17 @@ class TestConfigRunner(unittest.TestCase):
     # construct a fake node
     fake_node = objects.Node()
     # fail if we didn't read the config
-    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_node)
+    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_node,
+                          None)
 
     node = cfg.GetNodeInfo(cfg.GetNodeList()[0])
     # first pass, must not fail
-    cfg.Update(node)
+    cfg.Update(node, None)
     # second pass, also must not fail (after the config has been written)
-    cfg.Update(node)
+    cfg.Update(node, None)
     # but the fake_node update should still fail
-    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_node)
+    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_node,
+                          None)
 
   def testUpdateInstance(self):
     """Test updates on one instance object"""
@@ -141,16 +146,18 @@ class TestConfigRunner(unittest.TestCase):
     inst = self._create_instance()
     fake_instance = objects.Instance()
     # fail if we didn't read the config
-    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_instance)
+    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_instance,
+                          None)
 
-    cfg.AddInstance(inst)
+    cfg.AddInstance(inst, "my-job")
     instance = cfg.GetInstanceInfo(cfg.GetInstanceList()[0])
     # first pass, must not fail
-    cfg.Update(instance)
+    cfg.Update(instance, None)
     # second pass, also must not fail (after the config has been written)
-    cfg.Update(instance)
+    cfg.Update(instance, None)
     # but the fake_instance update should still fail
-    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_instance)
+    self.failUnlessRaises(errors.ConfigurationError, cfg.Update, fake_instance,
+                          None)
 
   def testNICParameterSyntaxCheck(self):
     """Test the NIC's CheckParameterSyntax function"""
@@ -172,4 +179,4 @@ class TestConfigRunner(unittest.TestCase):
 
 
 if __name__ == '__main__':
-  unittest.main()
+  testutils.GanetiTestProgram()