Revision a20e4768 test/ganeti.runtime_unittest.py
b/test/ganeti.runtime_unittest.py | ||
---|---|---|
23 | 23 |
from ganeti import constants |
24 | 24 |
from ganeti import errors |
25 | 25 |
from ganeti import runtime |
26 |
from ganeti import ht |
|
26 | 27 |
|
27 | 28 |
import testutils |
28 | 29 |
import unittest |
... | ... | |
138 | 139 |
self.resolver.LookupGroup, "does-not-exist-foo") |
139 | 140 |
|
140 | 141 |
|
142 |
class TestArchInfo(unittest.TestCase): |
|
143 |
EXP_TYPES = \ |
|
144 |
ht.TAnd(ht.TIsLength(2), |
|
145 |
ht.TItems([ |
|
146 |
ht.TNonEmptyString, |
|
147 |
ht.TNonEmptyString, |
|
148 |
])) |
|
149 |
|
|
150 |
def setUp(self): |
|
151 |
self.assertTrue(runtime._arch is None) |
|
152 |
|
|
153 |
def tearDown(self): |
|
154 |
runtime._arch = None |
|
155 |
|
|
156 |
def testNotInitialized(self): |
|
157 |
self.assertRaises(errors.ProgrammerError, runtime.GetArchInfo) |
|
158 |
|
|
159 |
def testInitializeMultiple(self): |
|
160 |
runtime.InitArchInfo() |
|
161 |
|
|
162 |
self.assertRaises(errors.ProgrammerError, runtime.InitArchInfo) |
|
163 |
|
|
164 |
def testNormal(self): |
|
165 |
runtime.InitArchInfo() |
|
166 |
|
|
167 |
info = runtime.GetArchInfo() |
|
168 |
|
|
169 |
self.assertTrue(self.EXP_TYPES(info), |
|
170 |
msg=("Doesn't match expected type description: %s" % |
|
171 |
self.EXP_TYPES)) |
|
172 |
|
|
173 |
|
|
141 | 174 |
if __name__ == "__main__": |
142 | 175 |
testutils.GanetiTestProgram() |
Also available in: Unified diff