Revision 28a34a39
b/test/ganeti.constants_unittest.py | ||
---|---|---|
74 | 74 |
(kind, key)) |
75 | 75 |
|
76 | 76 |
|
77 |
class TestConfdConstants(unittest.TestCase): |
|
78 |
"""Test the confd constants""" |
|
79 |
|
|
80 |
def testFourCc(self): |
|
81 |
self.failUnlessEqual(len(constants.CONFD_MAGIC_FOURCC), 4, |
|
82 |
"Invalid fourcc len, should be 4") |
|
83 |
|
|
84 |
def _IsUniqueSequence(self, sequence): |
|
85 |
seen = set() |
|
86 |
for member in sequence: |
|
87 |
if member in seen: |
|
88 |
return False |
|
89 |
seen.add(member) |
|
90 |
return True |
|
91 |
|
|
92 |
def testReqs(self): |
|
93 |
self.failUnless(self._IsUniqueSequence(constants.CONFD_REQS), |
|
94 |
"Duplicated confd request code") |
|
95 |
|
|
96 |
def testReplStatuses(self): |
|
97 |
self.failUnless(self._IsUniqueSequence(constants.CONFD_REPL_STATUSES), |
|
98 |
"Duplicated confd reply status code") |
|
99 |
|
|
100 |
|
|
77 | 101 |
if __name__ == '__main__': |
78 | 102 |
unittest.main() |
Also available in: Unified diff