Skip to content

Commit

Permalink
Fix TSAN bug in integration test (#14327)
Browse files Browse the repository at this point in the history
Don't delete the HTTP stream prematurely.

Signed-off-by: Alex Konradi <akonradi@google.com>
  • Loading branch information
akonradi authored Dec 8, 2020
1 parent 940958e commit 3b15582
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions test/integration/overload_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,13 @@ TEST_P(OverloadScaledTimerIntegrationTest, CloseIdleHttpConnections) {
{":method", "GET"}, {":path", "/test/long/url"}, {":scheme", "http"}, {":authority", "host"}};

// Create an HTTP connection and complete a request.
FakeStreamPtr http_stream;
codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http"))));
auto response = codec_client_->makeRequestWithBody(request_headers, 10);
ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_));
ASSERT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, http_stream));
ASSERT_TRUE(http_stream->waitForHeadersComplete());
ASSERT_TRUE(http_stream->waitForData(*dispatcher_, 10));
http_stream->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, true);
ASSERT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, upstream_request_));
ASSERT_TRUE(upstream_request_->waitForHeadersComplete());
ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, 10));
upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, true);
response->waitForEndStream();

// At this point, the connection should be idle but still open.
Expand All @@ -306,15 +305,14 @@ TEST_P(OverloadScaledTimerIntegrationTest, CloseIdleHttpConnections) {
// connection. If a new stream comes in, it will set the connection header
// to "close" on the response and close the connection after.
auto response = codec_client_->makeRequestWithBody(request_headers, 10);
ASSERT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, http_stream));
ASSERT_TRUE(http_stream->waitForHeadersComplete());
ASSERT_TRUE(http_stream->waitForData(*dispatcher_, 10));
ASSERT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, upstream_request_));
ASSERT_TRUE(upstream_request_->waitForHeadersComplete());
ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, 10));
response->waitForEndStream();
EXPECT_EQ(response->headers().getConnectionValue(), "close");
} else {
EXPECT_TRUE(codec_client_->sawGoAway());
}
http_stream.reset();
codec_client_->close();
}

Expand Down

0 comments on commit 3b15582

Please sign in to comment.