Increase ICMP timeout

We are still hitting the occasional flake in Fuchsia's CQ when polling for an
ICMP error. Increase the timeout from 2s => 5s.

PiperOrigin-RevId: 509655650
This commit is contained in:
Nick Brown
2023-02-14 15:34:12 -08:00
committed by gVisor bot
parent f3099f1288
commit 76057e7c63
+8 -4
View File
@@ -53,7 +53,11 @@ namespace testing {
namespace {
constexpr size_t kIcmpTimeout = 2000;
size_t IcmpTimeoutMillis() {
// Fuchsia's CI infra is susceptible to timing jumps. Set a long timeout
// to avoid flakes.
return GvisorPlatform() == Platform::kFuchsia ? 10000 : 1000;
}
// Fixture for tests parameterized by the address family to use (AF_INET and
// AF_INET6) when creating sockets.
@@ -401,7 +405,7 @@ TEST_P(UdpSocketTest, ConnectWriteToInvalidPort) {
// Poll to make sure we get the ICMP error back.
struct pollfd pfd = {sock_.get(), POLLERR, 0};
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, kIcmpTimeout),
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, IcmpTimeoutMillis()),
SyscallSucceedsWithValue(1));
// Now verify that we got an ICMP error back of ECONNREFUSED.
@@ -806,7 +810,7 @@ TEST_P(UdpSocketTest, ConnectAndSendNoReceiver) {
// Poll to make sure we get the ICMP error back before issuing more writes.
struct pollfd pfd = {sock_.get(), POLLERR, 0};
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, kIcmpTimeout),
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, IcmpTimeoutMillis()),
SyscallSucceedsWithValue(1));
// Next write should fail with ECONNREFUSED due to the ICMP error generated in
@@ -819,7 +823,7 @@ TEST_P(UdpSocketTest, ConnectAndSendNoReceiver) {
ASSERT_THAT(send(sock_.get(), buf, sizeof(buf), 0), SyscallSucceeds());
// Poll to make sure we get the ICMP error back before issuing more writes.
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, kIcmpTimeout),
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, IcmpTimeoutMillis()),
SyscallSucceedsWithValue(1));
// Next write should fail with ECONNREFUSED due to the ICMP error generated in