Skip to content

Commit

Permalink
test fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk committed May 26, 2022
1 parent f140470 commit 1022eea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,7 @@ TEST_P(CompressorProxyingConnectIntegrationTest, ProxyConnect) {
RELEASE_ASSERT(result, result.message());
ASSERT_TRUE(upstream_request_->waitForHeadersComplete());
EXPECT_EQ(upstream_request_->headers().get(Http::Headers::get().Method)[0]->value(), "CONNECT");
if (upstreamProtocol() == Http::CodecType::HTTP1) {
EXPECT_TRUE(upstream_request_->headers().get(Http::Headers::get().Protocol).empty());
} else {
EXPECT_EQ(upstream_request_->headers().get(Http::Headers::get().Protocol)[0]->value(),
"bytestream");
}
EXPECT_TRUE(upstream_request_->headers().get(Http::Headers::get().Protocol).empty());

// Send response headers
upstream_request_->encodeHeaders(default_response_headers_, false);
Expand Down
15 changes: 5 additions & 10 deletions test/extensions/filters/http/jwt_authn/filter_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,11 @@ TEST_P(LocalJwksIntegrationTest, ConnectRequestWithRegExMatch) {
request_encoder_ = &encoder_decoder.first;
auto response = std::move(encoder_decoder.second);

if (downstreamProtocol() == Http::CodecType::HTTP1) {
// Because CONNECT requests for HTTP/1 do not include a path, they will fail
// to find a route match and return a 404.
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("404", response->headers().getStatusValue());
} else {
ASSERT_TRUE(response->waitForReset());
ASSERT_TRUE(codec_client_->waitForDisconnect());
}
// Because CONNECT requests do not include a path, they will fail
// to find a route match and return a 404.
ASSERT_TRUE(response->waitForEndStream());
ASSERT_TRUE(response->complete());
EXPECT_EQ("404", response->headers().getStatusValue());
}

// The test case with a fake upstream for remote Jwks server.
Expand Down
19 changes: 8 additions & 11 deletions test/integration/protocol_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2733,19 +2733,15 @@ TEST_P(DownstreamProtocolIntegrationTest, ConnectIsBlocked) {
request_encoder_ = &encoder_decoder.first;
auto response = std::move(encoder_decoder.second);

if (downstreamProtocol() == Http::CodecType::HTTP1) {
// Because CONNECT requests for HTTP/1 do not include a path, they will fail
// to find a route match and return a 404.
ASSERT_TRUE(response->waitForEndStream());
EXPECT_EQ("404", response->headers().getStatusValue());
EXPECT_TRUE(response->complete());
} else {
ASSERT_TRUE(response->waitForReset());
ASSERT_TRUE(codec_client_->waitForDisconnect());
}
// Because CONNECT requests do not include a path, they will fail
// to find a route match and return a 404.
ASSERT_TRUE(response->waitForEndStream());
EXPECT_EQ("404", response->headers().getStatusValue());
EXPECT_TRUE(response->complete());
}

TEST_P(DownstreamProtocolIntegrationTest, ExtendedConnectIsBlocked) {
config_helper_.addRuntimeOverride("envoy.reloadable_features.use_rfc_connect", "false");
if (downstreamProtocol() == Http::CodecType::HTTP1) {
return;
}
Expand Down Expand Up @@ -2785,7 +2781,8 @@ TEST_P(DownstreamProtocolIntegrationTest, ConnectStreamRejection) {
auto response = codec_client_->makeHeaderOnlyRequest(
Http::TestRequestHeaderMapImpl{{":method", "CONNECT"}, {":authority", "sni.lyft.com"}});

ASSERT_TRUE(response->waitForReset());
ASSERT_TRUE(response->waitForEndStream());
EXPECT_EQ("404", response->headers().getStatusValue());
EXPECT_FALSE(codec_client_->disconnected());
}

Expand Down

0 comments on commit 1022eea

Please sign in to comment.