Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions source/extensions/filters/http/grpc_http1_bridge/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ envoy_cc_extension(
name = "config",
srcs = ["config.cc"],
hdrs = ["config.h"],
# Legacy test use. TODO(#9953) clean up.
extra_visibility = [
"//source/exe:__pkg__",
"//test/integration:__subpackages__",
"//test/server:__subpackages__",
],
deps = [
"//envoy/registry",
"//envoy/server:filter_config_interface",
Expand Down
15 changes: 15 additions & 0 deletions test/extensions/filters/http/grpc_http1_bridge/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,18 @@ envoy_extension_cc_test(
"//test/mocks/server:factory_context_mocks",
],
)

envoy_extension_cc_test(
name = "grpc_http1_bridge_integration_test",
srcs = [
"grpc_http1_bridge_integration_test.cc",
],
extension_names = ["envoy.filters.http.grpc_http1_bridge"],
deps = [
"//source/common/http:header_map_lib",
"//source/common/http:headers_lib",
"//source/extensions/filters/http/grpc_http1_bridge:config",
"//source/extensions/filters/http/health_check:config",
"//test/integration:http_integration_lib",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "test/integration/http_integration.h"

#include "gtest/gtest.h"

namespace Envoy {
namespace {

// A test class for testing HTTP/1.1 upstream and downstreams

class GrpcIntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
public HttpIntegrationTest {
public:
GrpcIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {}
};

// Test hitting the bridge filter with too many response bytes to buffer. Given
// the headers are not proxied, the connection manager will send a local error reply.
TEST_P(GrpcIntegrationTest, HittingGrpcFilterLimitBufferingHeaders) {
config_helper_.prependFilter(
"{ name: grpc_http1_bridge, typed_config: { \"@type\": "
"type.googleapis.com/envoy.extensions.filters.http.grpc_http1_bridge.v3.Config } }");
config_helper_.setBufferLimits(1024, 1024);
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));

auto response = codec_client_->makeHeaderOnlyRequest(
Http::TestRequestHeaderMapImpl{{":method", "POST"},
{":path", "/test/long/url"},
{":scheme", "http"},
{":authority", "host"},
{"content-type", "application/grpc"},
{"x-envoy-retry-grpc-on", "cancelled"}});
waitForNextUpstreamRequest();

// Send the overly large response. Because the grpc_http1_bridge filter buffers and buffer
// limits are exceeded, this will be translated into an unknown gRPC error.
upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, false);
upstream_request_->encodeData(1024 * 65, false);
ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect());

ASSERT_TRUE(response->waitForEndStream());
EXPECT_TRUE(response->complete());
EXPECT_THAT(response->headers(), Http::HttpStatusIs("200"));
EXPECT_THAT(response->headers(),
HeaderValueOf(Http::Headers::get().GrpcStatus, "2")); // Unknown gRPC error
}

INSTANTIATE_TEST_SUITE_P(IpVersions, GrpcIntegrationTest,
testing::ValuesIn(TestEnvironment::getIpVersionsForTest()),
TestUtility::ipTestParamsToString);

} // namespace
} // namespace Envoy
2 changes: 0 additions & 2 deletions test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,6 @@ envoy_cc_test(
":http_integration_lib",
"//source/common/http:header_map_lib",
"//source/common/http:headers_lib",
"//source/extensions/filters/http/grpc_http1_bridge:config",
"//source/extensions/filters/http/health_check:config",
"//test/integration/filters:clear_route_cache_filter_lib",
"//test/integration/filters:encoder_decoder_buffer_filter_lib",
Expand All @@ -956,7 +955,6 @@ envoy_cc_test(
"//test/test_common:utility_lib",
"@envoy_api//envoy/config/bootstrap/v3:pkg_cc_proto",
"@envoy_api//envoy/config/route/v3:pkg_cc_proto",
"@envoy_api//envoy/extensions/filters/http/grpc_http1_bridge/v3:pkg_cc_proto",
"@envoy_api//envoy/extensions/filters/network/http_connection_manager/v3:pkg_cc_proto",
],
)
Expand Down
33 changes: 0 additions & 33 deletions test/integration/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "envoy/config/bootstrap/v3/bootstrap.pb.h"
#include "envoy/config/route/v3/route_components.pb.h"
#include "envoy/extensions/filters/http/grpc_http1_bridge/v3/config.pb.h"
#include "envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.h"

#include "source/common/http/header_map_impl.h"
Expand Down Expand Up @@ -624,38 +623,6 @@ TEST_P(IntegrationTest, UpstreamDisconnectWithTwoRequests) {
test_server_->waitForCounterGe("cluster.cluster_0.upstream_rq_200", 2);
}

// Test hitting the bridge filter with too many response bytes to buffer. Given
// the headers are not proxied, the connection manager will send a local error reply.
TEST_P(IntegrationTest, HittingGrpcFilterLimitBufferingHeaders) {
config_helper_.prependFilter(
"{ name: grpc_http1_bridge, typed_config: { \"@type\": "
"type.googleapis.com/envoy.extensions.filters.http.grpc_http1_bridge.v3.Config } }");
config_helper_.setBufferLimits(1024, 1024);
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));

auto response = codec_client_->makeHeaderOnlyRequest(
Http::TestRequestHeaderMapImpl{{":method", "POST"},
{":path", "/test/long/url"},
{":scheme", "http"},
{":authority", "host"},
{"content-type", "application/grpc"},
{"x-envoy-retry-grpc-on", "cancelled"}});
waitForNextUpstreamRequest();

// Send the overly large response. Because the grpc_http1_bridge filter buffers and buffer
// limits are exceeded, this will be translated into an unknown gRPC error.
upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, false);
upstream_request_->encodeData(1024 * 65, false);
ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect());

ASSERT_TRUE(response->waitForEndStream());
EXPECT_TRUE(response->complete());
EXPECT_THAT(response->headers(), HttpStatusIs("200"));
EXPECT_THAT(response->headers(),
HeaderValueOf(Headers::get().GrpcStatus, "2")); // Unknown gRPC error
}

TEST_P(IntegrationTest, TestSmuggling) {
initialize();

Expand Down