-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: moving grpc bridge tests out of core directory (#18227)
Commit Message: n/a Additional Description: n/a Risk Level: n/a Testing: n/a Part of #9953 Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
- Loading branch information
1 parent
e77e587
commit b979155
Showing
5 changed files
with
68 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
test/extensions/filters/http/grpc_http1_bridge/grpc_http1_bridge_integration_test.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters