mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
testing: increase some timeouts in packet tests
These are unnecessarily short, and can cause flakes. Startblock: cl/698155239 is submitted PiperOrigin-RevId: 698863623
This commit is contained in:
committed by
gVisor bot
parent
ae1d4ccf02
commit
0752ab653e
@@ -69,6 +69,7 @@ using ::testing::Eq;
|
||||
|
||||
constexpr char kMessage[] = "soweoneul malhaebwa";
|
||||
constexpr in_port_t kPort = 0x409c; // htons(40000)
|
||||
constexpr int kTimeoutMS = 60 * 1000;
|
||||
|
||||
//
|
||||
// "Cooked" tests. Cooked AF_PACKET sockets do not contain link layer
|
||||
@@ -107,7 +108,8 @@ TEST(BasicCookedPacketTest, WrongType) {
|
||||
struct pollfd pfd = {};
|
||||
pfd.fd = sock.get();
|
||||
pfd.events = POLLIN;
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, 1000), SyscallSucceedsWithValue(0));
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, kTimeoutMS),
|
||||
SyscallSucceedsWithValue(0));
|
||||
}
|
||||
|
||||
// Tests for "cooked" (SOCK_DGRAM) packet(7) sockets.
|
||||
@@ -171,7 +173,8 @@ void ReceiveMessage(int sock, int ifindex) {
|
||||
struct pollfd pfd = {};
|
||||
pfd.fd = sock;
|
||||
pfd.events = POLLIN;
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, 2000), SyscallSucceedsWithValue(1));
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, kTimeoutMS),
|
||||
SyscallSucceedsWithValue(1));
|
||||
|
||||
// Read and verify the data.
|
||||
constexpr size_t packet_size =
|
||||
@@ -300,10 +303,12 @@ TEST_P(CookedPacketTest, Send) {
|
||||
struct pollfd pfd = {};
|
||||
pfd.fd = udp_sock.get();
|
||||
pfd.events = POLLIN;
|
||||
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, 5000), SyscallSucceedsWithValue(1));
|
||||
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, kTimeoutMS),
|
||||
SyscallSucceedsWithValue(1));
|
||||
pfd.fd = socket_;
|
||||
pfd.events = POLLIN;
|
||||
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, 5000), SyscallSucceedsWithValue(1));
|
||||
ASSERT_THAT(RetryEINTR(poll)(&pfd, 1, kTimeoutMS),
|
||||
SyscallSucceedsWithValue(1));
|
||||
|
||||
// Receive on the packet socket.
|
||||
char recv_buf[sizeof(send_buf)];
|
||||
@@ -418,7 +423,8 @@ TEST_P(CookedPacketTest, BindDrop) {
|
||||
struct pollfd pfd = {};
|
||||
pfd.fd = socket_;
|
||||
pfd.events = POLLIN;
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, 1000), SyscallSucceedsWithValue(0));
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, kTimeoutMS),
|
||||
SyscallSucceedsWithValue(0));
|
||||
}
|
||||
|
||||
// Verify that we receive outbound packets. This test requires at least one
|
||||
@@ -488,7 +494,8 @@ TEST_P(CookedPacketTest, ReceiveOutbound) {
|
||||
struct pollfd pfd = {};
|
||||
pfd.fd = socket_;
|
||||
pfd.events = POLLIN;
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, 1000), SyscallSucceedsWithValue(1));
|
||||
EXPECT_THAT(RetryEINTR(poll)(&pfd, 1, kTimeoutMS),
|
||||
SyscallSucceedsWithValue(1));
|
||||
|
||||
// Now read and check that the packet is the one we just sent.
|
||||
// Read and verify the data.
|
||||
|
||||
Reference in New Issue
Block a user