Revision 76fda900 test/py/qa.qa_config_unittest.py
b/test/py/qa.qa_config_unittest.py | ||
---|---|---|
222 | 222 |
# Unknown hypervisor |
223 | 223 |
testconfig[qa_config._ENABLED_HV_KEY] = ["#unknownhv#"] |
224 | 224 |
check_fn("Unknown hypervisor(s) enabled:") |
225 |
del testconfig[qa_config._ENABLED_HV_KEY] |
|
226 |
|
|
227 |
# Invalid path for virtual cluster base directory |
|
228 |
testconfig[qa_config._VCLUSTER_MASTER_KEY] = "value" |
|
229 |
testconfig[qa_config._VCLUSTER_BASEDIR_KEY] = "./not//normalized/" |
|
230 |
check_fn("Path given in option 'vcluster-basedir' must be") |
|
231 |
|
|
232 |
# Inconsistent virtual cluster settings |
|
233 |
testconfig.pop(qa_config._VCLUSTER_MASTER_KEY) |
|
234 |
testconfig[qa_config._VCLUSTER_BASEDIR_KEY] = "/tmp" |
|
235 |
check_fn("All or none of the") |
|
236 |
|
|
237 |
testconfig[qa_config._VCLUSTER_MASTER_KEY] = "master.example.com" |
|
238 |
testconfig.pop(qa_config._VCLUSTER_BASEDIR_KEY) |
|
239 |
check_fn("All or none of the") |
|
240 |
|
|
241 |
# Accepted virtual cluster settings |
|
242 |
testconfig[qa_config._VCLUSTER_MASTER_KEY] = "master.example.com" |
|
243 |
testconfig[qa_config._VCLUSTER_BASEDIR_KEY] = "/tmp" |
|
244 |
|
|
245 |
self._WriteConfig(filename, testconfig) |
|
246 |
result = qa_config._QaConfig.Load(filename) |
|
247 |
self.assertEqual(result.GetVclusterSettings(), |
|
248 |
("master.example.com", "/tmp")) |
|
225 | 249 |
|
226 | 250 |
|
227 | 251 |
class TestQaConfigWithSampleConfig(unittest.TestCase): |
... | ... | |
257 | 281 |
def testGetMasterNode(self): |
258 | 282 |
self.assertEqual(self.config.GetMasterNode(), self.config["nodes"][0]) |
259 | 283 |
|
284 |
def testGetVclusterSettings(self): |
|
285 |
# Shipped default settings should be to not use a virtual cluster |
|
286 |
self.assertEqual(self.config.GetVclusterSettings(), (None, None)) |
|
287 |
|
|
288 |
self.assertFalse(qa_config.UseVirtualCluster(_cfg=self.config)) |
|
289 |
|
|
260 | 290 |
|
261 | 291 |
class TestQaConfig(unittest.TestCase): |
262 | 292 |
def setUp(self): |
Also available in: Unified diff