Revision a744b676 test/ganeti.backend_unittest.py
b/test/ganeti.backend_unittest.py | ||
---|---|---|
30 | 30 |
from ganeti import utils |
31 | 31 |
from ganeti import constants |
32 | 32 |
from ganeti import backend |
33 |
from ganeti import netutils |
|
33 | 34 |
|
34 | 35 |
import testutils |
35 | 36 |
|
... | ... | |
73 | 74 |
class TestNodeVerify(testutils.GanetiTestCase): |
74 | 75 |
def testMasterIPLocalhost(self): |
75 | 76 |
# this a real functional test, but requires localhost to be reachable |
76 |
local_data = (utils.HostInfo().name, constants.IP4_ADDRESS_LOCALHOST) |
|
77 |
local_data = (netutils.HostInfo().name, constants.IP4_ADDRESS_LOCALHOST)
|
|
77 | 78 |
result = backend.VerifyNode({constants.NV_MASTERIP: local_data}, None) |
78 | 79 |
self.failUnless(constants.NV_MASTERIP in result, |
79 | 80 |
"Master IP data not returned") |
... | ... | |
84 | 85 |
# RFC 5735 |
85 | 86 |
bad_data = ("master.example.com", "192.0.2.1") |
86 | 87 |
# we just test that whatever TcpPing returns, VerifyNode returns too |
87 |
utils.TcpPing = lambda a, b, source=None: False |
|
88 |
netutils.TcpPing = lambda a, b, source=None: False
|
|
88 | 89 |
result = backend.VerifyNode({constants.NV_MASTERIP: bad_data}, None) |
89 | 90 |
self.failUnless(constants.NV_MASTERIP in result, |
90 | 91 |
"Master IP data not returned") |
91 | 92 |
self.failIf(result[constants.NV_MASTERIP], |
92 |
"Result from utils.TcpPing corrupted") |
|
93 |
"Result from netutils.TcpPing corrupted")
|
|
93 | 94 |
|
94 | 95 |
|
95 | 96 |
if __name__ == "__main__": |
Also available in: Unified diff