Skip to content

Commit

Permalink
quic: fix flaky gso test (envoyproxy#29855)
Browse files Browse the repository at this point in the history
Potential fix to flakiness caused by missing Read event when I/O event callback is triggered.

  test/common/network/udp_listener_impl_test.cc:610: Failure
  Actual function call count doesn't match EXPECT_CALL(listener_callbacks_, onReadReady())...
           Expected: to be called once
             Actual: never called - unsatisfied and active

This indicates Read event is not present when the test is unblocked. Maybe a Write only event is bubbled up at the beginning.

Risk Level: low, test only
Testing: existing tests pass
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A
Fixes envoyproxy#29310
Signed-off-by: Dan Zhang <[email protected]>
  • Loading branch information
danzh2010 authored Oct 2, 2023
1 parent 420677a commit 1eb64ee
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions test/common/network/udp_listener_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,9 @@ TEST_P(UdpListenerImplTest, UdpGroBasic) {
}))
.WillRepeatedly(Return(Api::SysCallSizeResult{-1, EAGAIN}));

EXPECT_CALL(listener_callbacks_, onReadReady());
EXPECT_CALL(listener_callbacks_, onReadReady()).WillOnce(Invoke([&]() { dispatcher_->exit(); }));
EXPECT_CALL(listener_callbacks_, onData(_))
.WillOnce(Invoke([&](const UdpRecvData& data) -> void {
validateRecvCallbackParams(data, client_data.size());

const std::string data_str = data.buffer_->toString();
EXPECT_EQ(data_str, client_data[num_packets_received_by_listener_ - 1]);
}))
.Times(4u)
.WillRepeatedly(Invoke([&](const UdpRecvData& data) -> void {
validateRecvCallbackParams(data, client_data.size());

Expand All @@ -624,7 +619,6 @@ TEST_P(UdpListenerImplTest, UdpGroBasic) {

EXPECT_CALL(listener_callbacks_, onWriteReady(_)).WillOnce(Invoke([&](const Socket& socket) {
EXPECT_EQ(&socket.ioHandle(), &server_socket_->ioHandle());
dispatcher_->exit();
}));

dispatcher_->run(Event::Dispatcher::RunType::Block);
Expand Down

0 comments on commit 1eb64ee

Please sign in to comment.