From f80bfeea8e5a7452887bc27055ac065d3f7da6d9 Mon Sep 17 00:00:00 2001 From: Asra Ali Date: Wed, 18 Mar 2020 13:14:48 -0400 Subject: [PATCH] fix flake Signed-off-by: Asra Ali --- test/integration/protocol_integration_test.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/integration/protocol_integration_test.cc b/test/integration/protocol_integration_test.cc index 905e84a94a2af..7839bfd5b0eaa 100644 --- a/test/integration/protocol_integration_test.cc +++ b/test/integration/protocol_integration_test.cc @@ -991,21 +991,21 @@ TEST_P(DownstreamProtocolIntegrationTest, ManyRequestTrailersRejected) { initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); + fake_upstreams_[0]->set_allow_unexpected_disconnects(true); auto encoder_decoder = codec_client_->startRequest(default_request_headers_); request_encoder_ = &encoder_decoder.first; auto response = std::move(encoder_decoder.second); codec_client_->sendData(*request_encoder_, 1, false); codec_client_->sendTrailers(*request_encoder_, request_trailers); - // Expect rejection. - // TODO(asraa): we shouldn't need this unexpected disconnect, but some tests hit unparented - // connections without it. Likely need to reconsider whether the waits/closes should be on - // client or upstream. - fake_upstreams_[0]->set_allow_unexpected_disconnects(true); - ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); - response->waitForReset(); - ASSERT_TRUE(fake_upstream_connection_->close()); - ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); + if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + codec_client_->waitForDisconnect(); + EXPECT_TRUE(response->complete()); + EXPECT_EQ("431", response->headers().Status()->value().getStringView()); + } else { + response->waitForReset(); + codec_client_->close(); + } } TEST_P(DownstreamProtocolIntegrationTest, ManyRequestTrailersAccepted) {