Commit a4290316 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

skip AsyncSocketTest.ConnectTimeout if the address is unreachable

Summary:
The code in AsyncSocketTest.ConnectTimeout attempts to pick an IP address to
connect to that will time out rather than failing immediately.  It checks to
see if IPv4 or IPv6 is available, but it cannot easily check if routes are
available.  If IPv6 is available but no routes are configured it will use IPv6,
and then the connect attempt will fail immediately rather than timing out.

This changes the test to simply report itself as skipped in this case rather
than failing.

Reviewed By: yfeldblum

Differential Revision: D6843332

fbshipit-source-id: 02ef3dd42f1d4b6e35edfe93b2e5e42c6666fa52
parent 600568ee
......@@ -178,6 +178,12 @@ TEST(AsyncSocketTest, ConnectTimeout) {
evb.loop();
ASSERT_EQ(cb.state, STATE_FAILED);
if (cb.exception.getType() == AsyncSocketException::NOT_OPEN) {
// This can happen if we could not route to the IP address picked above.
// In this case the connect will fail immediately rather than timing out.
// Just skip the test in this case.
SKIP() << "do not have a routable but unreachable IP address";
}
ASSERT_EQ(cb.exception.getType(), AsyncSocketException::TIMED_OUT);
// Verify that we can still get the peer address after a timeout.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment