from ganeti import objects
from ganeti import utils
+import testutils
+
class TestConfigRunner(unittest.TestCase):
"""Testing case for HooksRunner"""
master_netdev=constants.DEFAULT_BRIDGE,
cluster_name="cluster.local",
file_storage_dir="/tmp",
+ uid_pool=[],
)
master_node_config = objects.Node(name=me.name,
# 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"""
# 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"""
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"""
if __name__ == '__main__':
- unittest.main()
+ testutils.GanetiTestProgram()