Revision 3697def0 test/py/ganeti.config_unittest.py
b/test/py/ganeti.config_unittest.py | ||
---|---|---|
74 | 74 |
"""Initializes the cfg object""" |
75 | 75 |
me = netutils.Hostname() |
76 | 76 |
ip = constants.IP4_ADDRESS_LOCALHOST |
77 |
# master_ip must not conflict with the node ip address |
|
78 |
master_ip = "127.0.0.2" |
|
77 | 79 |
|
78 | 80 |
cluster_config = objects.Cluster( |
79 | 81 |
serial_no=1, |
... | ... | |
87 | 89 |
tcpudp_port_pool=set(), |
88 | 90 |
enabled_hypervisors=[constants.HT_FAKE], |
89 | 91 |
master_node=me.name, |
90 |
master_ip="127.0.0.1",
|
|
92 |
master_ip=master_ip,
|
|
91 | 93 |
master_netdev=constants.DEFAULT_BRIDGE, |
92 | 94 |
cluster_name="cluster.local", |
93 | 95 |
file_storage_dir="/tmp", |
... | ... | |
426 | 428 |
finally: |
427 | 429 |
node2.group = orig_group |
428 | 430 |
|
431 |
def testVerifyConfig(self): |
|
432 |
cfg = self._get_object() |
|
433 |
|
|
434 |
errs = cfg.VerifyConfig() |
|
435 |
self.assertFalse(errs) |
|
436 |
|
|
437 |
node = cfg.GetNodeInfo(cfg.GetNodeList()[0]) |
|
438 |
key = list(constants.NDC_GLOBALS)[0] |
|
439 |
node.ndparams[key] = constants.NDC_DEFAULTS[key] |
|
440 |
errs = cfg.VerifyConfig() |
|
441 |
self.assertTrue(len(errs) >= 1) |
|
442 |
self.assertTrue(_IsErrorInList("has some global parameters set", errs)) |
|
443 |
|
|
444 |
del node.ndparams[key] |
|
445 |
errs = cfg.VerifyConfig() |
|
446 |
self.assertFalse(errs) |
|
447 |
|
|
448 |
|
|
449 |
def _IsErrorInList(err_str, err_list): |
|
450 |
return any(map(lambda e: err_str in e, err_list)) |
|
451 |
|
|
429 | 452 |
|
430 | 453 |
class TestTRM(unittest.TestCase): |
431 | 454 |
EC_ID = 1 |
Also available in: Unified diff