Skip to content

Commit

Permalink
Fix flaky test QuicHttpIntegrationTest::DeferredLoggingWithRetransmis…
Browse files Browse the repository at this point in the history
…sion (envoyproxy#27850)

Fixes envoyproxy#27841:

Increase the sleep from 500->1000 ms.
Properly clean up the SocketInterfaceSwap.
Commit Message: Fix flaky test DeferredLoggingWithRetransmission
Risk Level: N/A, just testing

Signed-off-by: Paul Sohn <paulsohn@google.com>
Signed-off-by: asheryer <asheryer@amazon.com>
  • Loading branch information
pksohn authored and asheryerm committed Jul 5, 2023
1 parent b987f92 commit 1e16b9c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/integration/quic_http_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1392,16 +1392,16 @@ TEST_P(QuicHttpIntegrationTest, DeferredLoggingWithRetransmission) {

// Temporarily prevent server from writing packets (i.e. to respond to downstream)
// to simulate packet loss and trigger retransmissions.
SocketInterfaceSwap socket_swap(upstreamProtocol() == Http::CodecType::HTTP3
? Network::Socket::Type::Datagram
: Network::Socket::Type::Stream);
Network::IoSocketError* ebadf = Network::IoSocketError::getIoSocketEbadfInstance();
socket_swap.write_matcher_->setDestinationPort(lookupPort("http"));
socket_swap.write_matcher_->setWriteOverride(ebadf);
upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, true);
absl::SleepFor(absl::Milliseconds(500 * TSAN_TIMEOUT_FACTOR));
// Allow the response to be sent downstream again.
socket_swap.write_matcher_->setWriteOverride(nullptr);
{
SocketInterfaceSwap socket_swap(downstreamProtocol() == Http::CodecType::HTTP3
? Network::Socket::Type::Datagram
: Network::Socket::Type::Stream);
Network::IoSocketError* ebadf = Network::IoSocketError::getIoSocketEbadfInstance();
socket_swap.write_matcher_->setDestinationPort(lookupPort("http"));
socket_swap.write_matcher_->setWriteOverride(ebadf);
upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, true);
timeSystem().advanceTimeWait(std::chrono::seconds(TSAN_TIMEOUT_FACTOR));
}

ASSERT_TRUE(response->waitForEndStream());
codec_client_->close();
Expand Down

0 comments on commit 1e16b9c

Please sign in to comment.