Revision 580b1fdd test/py/ganeti.opcodes_unittest.py
b/test/py/ganeti.opcodes_unittest.py | ||
---|---|---|
27 | 27 |
|
28 | 28 |
from ganeti import utils |
29 | 29 |
from ganeti import opcodes |
30 |
from ganeti import opcodes_base |
|
30 | 31 |
from ganeti import ht |
31 | 32 |
from ganeti import constants |
32 | 33 |
from ganeti import errors |
... | ... | |
56 | 57 |
self.assert_(cls.OP_ID.startswith("OP_")) |
57 | 58 |
self.assert_(len(cls.OP_ID) > 3) |
58 | 59 |
self.assertEqual(cls.OP_ID, cls.OP_ID.upper()) |
59 |
self.assertEqual(cls.OP_ID, opcodes._NameToId(cls.__name__)) |
|
60 |
self.assertEqual(cls.OP_ID, opcodes_base._NameToId(cls.__name__))
|
|
60 | 61 |
self.assertFalse(compat.any(cls.OP_ID.startswith(prefix) |
61 |
for prefix in opcodes._SUMMARY_PREFIX.keys()))
|
|
62 |
for prefix in opcodes_base.SUMMARY_PREFIX.keys()))
|
|
62 | 63 |
if cls in MISSING_RESULT_CHECK: |
63 | 64 |
self.assertTrue(cls.OP_RESULT is None, |
64 | 65 |
msg=("%s is listed to not have a result check" % |
... | ... | |
132 | 133 |
self.assertEqual(OpTest(data="b").Summary(), "TEST(a)") |
133 | 134 |
|
134 | 135 |
def testTinySummary(self): |
135 |
self.assertFalse(utils.FindDuplicates(opcodes._SUMMARY_PREFIX.values())) |
|
136 |
self.assertFalse( |
|
137 |
utils.FindDuplicates(opcodes_base.SUMMARY_PREFIX.values())) |
|
136 | 138 |
self.assertTrue(compat.all(prefix.endswith("_") and supplement.endswith("_") |
137 | 139 |
for (prefix, supplement) in |
138 |
opcodes._SUMMARY_PREFIX.items()))
|
|
140 |
opcodes_base.SUMMARY_PREFIX.items()))
|
|
139 | 141 |
|
140 | 142 |
self.assertEqual(opcodes.OpClusterPostInit().TinySummary(), "C_POST_INIT") |
141 | 143 |
self.assertEqual(opcodes.OpNodeRemove().TinySummary(), "N_REMOVE") |
... | ... | |
164 | 166 |
def testParams(self): |
165 | 167 |
supported_by_all = set(["debug_level", "dry_run", "priority"]) |
166 | 168 |
|
167 |
self.assertTrue(opcodes.BaseOpCode not in opcodes.OP_MAPPING.values()) |
|
169 |
self.assertTrue(opcodes_base.BaseOpCode not in opcodes.OP_MAPPING.values())
|
|
168 | 170 |
self.assertTrue(opcodes.OpCode not in opcodes.OP_MAPPING.values()) |
169 | 171 |
|
170 | 172 |
for cls in opcodes.OP_MAPPING.values() + [opcodes.OpCode]: |
... | ... | |
328 | 330 |
|
329 | 331 |
class TestOpcodeDepends(unittest.TestCase): |
330 | 332 |
def test(self): |
331 |
check_relative = opcodes._BuildJobDepCheck(True)
|
|
332 |
check_norelative = opcodes.TNoRelativeJobDependencies |
|
333 |
check_relative = opcodes_base.BuildJobDepCheck(True)
|
|
334 |
check_norelative = opcodes_base.TNoRelativeJobDependencies
|
|
333 | 335 |
|
334 | 336 |
for fn in [check_relative, check_norelative]: |
335 | 337 |
self.assertTrue(fn(None)) |
Also available in: Unified diff