Skip to content
Snippets Groups Projects
Commit 45d4c81c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Add opcode parameter descriptions


These will be used in automatically generated parts of the RAPI
documentation. Not all opcodes are documented so far, but each added
opcode's parameters need to be fully documented (verified by an
assertion).

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 197b323b
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -30,6 +30,7 @@ from ganeti import opcodes ...@@ -30,6 +30,7 @@ from ganeti import opcodes
from ganeti import ht from ganeti import ht
from ganeti import constants from ganeti import constants
from ganeti import errors from ganeti import errors
from ganeti import compat
import testutils import testutils
...@@ -156,12 +157,17 @@ class TestOpcodes(unittest.TestCase): ...@@ -156,12 +157,17 @@ class TestOpcodes(unittest.TestCase):
self.assert_(test is None or test is ht.NoType or callable(test), self.assert_(test is None or test is ht.NoType or callable(test),
msg=("Invalid type check for %s.%s" % msg=("Invalid type check for %s.%s" %
(cls.OP_ID, attr_name))) (cls.OP_ID, attr_name)))
self.assertTrue(doc is None) self.assertTrue(doc is None or isinstance(doc, basestring))
if callable(aval): if callable(aval):
self.assertFalse(callable(aval()), self.assertFalse(callable(aval()),
msg="Default value returned by function is callable") msg="Default value returned by function is callable")
# If any parameter has documentation, all others need to have it as well
has_doc = [doc is not None for (_, _, _, doc) in cls.OP_PARAMS]
self.assertTrue(not compat.any(has_doc) or compat.all(has_doc),
msg="%s does not document all parameters" % cls)
def testValidateNoModification(self): def testValidateNoModification(self):
class OpTest(opcodes.OpCode): class OpTest(opcodes.OpCode):
OP_PARAMS = [ OP_PARAMS = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment