Remove 15-second sleep from LUInstanceCreate
[ganeti-local] / test / ganeti.cmdlib_unittest.py
index 2341789..b44c547 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 #
 
-# Copyright (C) 2008 Google Inc.
+# Copyright (C) 2008, 2011 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -57,12 +57,12 @@ class TestCertVerification(testutils.GanetiTestCase):
     nonexist_filename = os.path.join(self.tmpdir, "does-not-exist")
 
     (errcode, msg) = cmdlib._VerifyCertificate(nonexist_filename)
-    self.assertEqual(errcode, cmdlib.LUClusterVerify.ETYPE_ERROR)
+    self.assertEqual(errcode, cmdlib.LUClusterVerifyConfig.ETYPE_ERROR)
 
     # Try to load non-certificate file
     invalid_cert = self._TestDataFilename("bdev-net.txt")
     (errcode, msg) = cmdlib._VerifyCertificate(invalid_cert)
-    self.assertEqual(errcode, cmdlib.LUClusterVerify.ETYPE_ERROR)
+    self.assertEqual(errcode, cmdlib.LUClusterVerifyConfig.ETYPE_ERROR)
 
 
 class TestOpcodeParams(testutils.GanetiTestCase):
@@ -85,17 +85,16 @@ class TestIAllocatorChecks(testutils.GanetiTestCase):
         self.cfg = mocks.FakeConfig()
         self.op = opcode
 
-    class TestOpcode(opcodes.OpCode):
-      OP_ID = "OP_TEST"
-      OP_PARAMS = [
-        ("iallocator", None, ht.NoType),
-        ("node", None, ht.NoType),
+    class OpTest(opcodes.OpCode):
+       OP_PARAMS = [
+        ("iallocator", None, ht.NoType, None),
+        ("node", None, ht.NoType, None),
         ]
 
     default_iallocator = mocks.FakeConfig().GetDefaultIAllocator()
     other_iallocator = default_iallocator + "_not"
 
-    op = TestOpcode()
+    op = OpTest()
     lu = TestLU(op)
 
     c_i = lambda: cmdlib._CheckIAllocatorOrNode(lu, "iallocator", "node")
@@ -144,12 +143,12 @@ class TestLUTestJqueue(unittest.TestCase):
 class TestLUQuery(unittest.TestCase):
   def test(self):
     self.assertEqual(sorted(cmdlib._QUERY_IMPL.keys()),
-                     sorted(constants.QR_OP_QUERY))
+                     sorted(constants.QR_VIA_OP))
 
-    assert constants.QR_NODE in constants.QR_OP_QUERY
-    assert constants.QR_INSTANCE in constants.QR_OP_QUERY
+    assert constants.QR_NODE in constants.QR_VIA_OP
+    assert constants.QR_INSTANCE in constants.QR_VIA_OP
 
-    for i in constants.QR_OP_QUERY:
+    for i in constants.QR_VIA_OP:
       self.assert_(cmdlib._GetQueryImplementation(i))
 
     self.assertRaises(errors.OpPrereqError, cmdlib._GetQueryImplementation, "")