Revision 9769bb78 test/ganeti.utils_unittest.py
b/test/ganeti.utils_unittest.py | ||
---|---|---|
1169 | 1169 |
|
1170 | 1170 |
def setUp(self): |
1171 | 1171 |
self.listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
1172 |
self.listener.bind((constants.LOCALHOST_IP_ADDRESS, 0))
|
|
1172 |
self.listener.bind((constants.IP4_ADDRESS_LOCALHOST, 0))
|
|
1173 | 1173 |
self.listenerport = self.listener.getsockname()[1] |
1174 | 1174 |
self.listener.listen(1) |
1175 | 1175 |
|
... | ... | |
1179 | 1179 |
del self.listenerport |
1180 | 1180 |
|
1181 | 1181 |
def testTcpPingToLocalHostAccept(self): |
1182 |
self.assert_(TcpPing(constants.LOCALHOST_IP_ADDRESS,
|
|
1182 |
self.assert_(TcpPing(constants.IP4_ADDRESS_LOCALHOST,
|
|
1183 | 1183 |
self.listenerport, |
1184 | 1184 |
timeout=10, |
1185 | 1185 |
live_port_needed=True, |
1186 |
source=constants.LOCALHOST_IP_ADDRESS,
|
|
1186 |
source=constants.IP4_ADDRESS_LOCALHOST,
|
|
1187 | 1187 |
), |
1188 | 1188 |
"failed to connect to test listener") |
1189 | 1189 |
|
1190 |
self.assert_(TcpPing(constants.LOCALHOST_IP_ADDRESS,
|
|
1190 |
self.assert_(TcpPing(constants.IP4_ADDRESS_LOCALHOST,
|
|
1191 | 1191 |
self.listenerport, |
1192 | 1192 |
timeout=10, |
1193 | 1193 |
live_port_needed=True, |
... | ... | |
1200 | 1200 |
|
1201 | 1201 |
def setUp(self): |
1202 | 1202 |
self.deaflistener = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
1203 |
self.deaflistener.bind((constants.LOCALHOST_IP_ADDRESS, 0))
|
|
1203 |
self.deaflistener.bind((constants.IP4_ADDRESS_LOCALHOST, 0))
|
|
1204 | 1204 |
self.deaflistenerport = self.deaflistener.getsockname()[1] |
1205 | 1205 |
|
1206 | 1206 |
def tearDown(self): |
... | ... | |
1208 | 1208 |
del self.deaflistenerport |
1209 | 1209 |
|
1210 | 1210 |
def testTcpPingToLocalHostAcceptDeaf(self): |
1211 |
self.failIf(TcpPing(constants.LOCALHOST_IP_ADDRESS,
|
|
1211 |
self.failIf(TcpPing(constants.IP4_ADDRESS_LOCALHOST,
|
|
1212 | 1212 |
self.deaflistenerport, |
1213 | 1213 |
timeout=constants.TCP_PING_TIMEOUT, |
1214 | 1214 |
live_port_needed=True, |
1215 |
source=constants.LOCALHOST_IP_ADDRESS,
|
|
1215 |
source=constants.IP4_ADDRESS_LOCALHOST,
|
|
1216 | 1216 |
), # need successful connect(2) |
1217 | 1217 |
"successfully connected to deaf listener") |
1218 | 1218 |
|
1219 |
self.failIf(TcpPing(constants.LOCALHOST_IP_ADDRESS,
|
|
1219 |
self.failIf(TcpPing(constants.IP4_ADDRESS_LOCALHOST,
|
|
1220 | 1220 |
self.deaflistenerport, |
1221 | 1221 |
timeout=constants.TCP_PING_TIMEOUT, |
1222 | 1222 |
live_port_needed=True, |
... | ... | |
1224 | 1224 |
"successfully connected to deaf listener (no source addr)") |
1225 | 1225 |
|
1226 | 1226 |
def testTcpPingToLocalHostNoAccept(self): |
1227 |
self.assert_(TcpPing(constants.LOCALHOST_IP_ADDRESS,
|
|
1227 |
self.assert_(TcpPing(constants.IP4_ADDRESS_LOCALHOST,
|
|
1228 | 1228 |
self.deaflistenerport, |
1229 | 1229 |
timeout=constants.TCP_PING_TIMEOUT, |
1230 | 1230 |
live_port_needed=False, |
1231 |
source=constants.LOCALHOST_IP_ADDRESS,
|
|
1231 |
source=constants.IP4_ADDRESS_LOCALHOST,
|
|
1232 | 1232 |
), # ECONNREFUSED is OK |
1233 | 1233 |
"failed to ping alive host on deaf port") |
1234 | 1234 |
|
1235 |
self.assert_(TcpPing(constants.LOCALHOST_IP_ADDRESS,
|
|
1235 |
self.assert_(TcpPing(constants.IP4_ADDRESS_LOCALHOST,
|
|
1236 | 1236 |
self.deaflistenerport, |
1237 | 1237 |
timeout=constants.TCP_PING_TIMEOUT, |
1238 | 1238 |
live_port_needed=False, |
... | ... | |
1245 | 1245 |
|
1246 | 1246 |
def testOwnLoopback(self): |
1247 | 1247 |
"""check having the loopback ip""" |
1248 |
self.failUnless(OwnIpAddress(constants.LOCALHOST_IP_ADDRESS),
|
|
1248 |
self.failUnless(OwnIpAddress(constants.IP4_ADDRESS_LOCALHOST),
|
|
1249 | 1249 |
"Should own the loopback address") |
1250 | 1250 |
|
1251 | 1251 |
def testNowOwnAddress(self): |
Also available in: Unified diff