Skip to content

Commit

Permalink
http3: turning up upstream integration test (#15841)
Browse files Browse the repository at this point in the history
Turning up http2 upstream tests for http3.

Risk Level: n/a (test only)
Testing: yes
Docs Changes: n/a
Release Notes: n/a
Part of #15649

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
  • Loading branch information
alyssawilk authored Apr 6, 2021
1 parent b068400 commit 2858cd2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 28 deletions.
3 changes: 0 additions & 3 deletions source/common/quic/envoy_quic_client_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ void EnvoyQuicClientStream::resetStream(Http::StreamResetReason reason) {
}

void EnvoyQuicClientStream::switchStreamBlockState(bool should_block) {
ASSERT(FinishedReadingHeaders(),
"Upper stream buffer limit is reached before response body is delivered.");
if (should_block) {
sequencer()->SetBlockedUntilFlush();
} else {
Expand Down Expand Up @@ -244,7 +242,6 @@ void EnvoyQuicClientStream::OnTrailingHeadersComplete(bool fin, size_t frame_len

void EnvoyQuicClientStream::maybeDecodeTrailers() {
if (sequencer()->IsClosed() && !FinishedReadingTrailers()) {
ASSERT(!received_trailers().empty());
// Only decode trailers after finishing decoding body.
end_stream_decoded_ = true;
response_decoder_->decodeTrailers(
Expand Down
9 changes: 5 additions & 4 deletions test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,14 @@ envoy_cc_test(
)

envoy_cc_test(
name = "http2_upstream_integration_test",
name = "multiplexed_upstream_integration_test",
srcs = [
"http2_upstream_integration_test.cc",
"http2_upstream_integration_test.h",
"multiplexed_upstream_integration_test.cc",
"multiplexed_upstream_integration_test.h",
],
shard_count = 2,
deps = [
":http_integration_lib",
":http_protocol_integration_lib",
"//source/common/http:header_map_lib",
"//source/extensions/access_loggers/grpc:http_config",
"//source/extensions/filters/http/buffer:config",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "test/integration/http2_upstream_integration_test.h"
#include "test/integration/multiplexed_upstream_integration_test.h"

#include <iostream>

Expand All @@ -15,9 +15,24 @@

namespace Envoy {

INSTANTIATE_TEST_SUITE_P(IpVersions, Http2UpstreamIntegrationTest,
testing::ValuesIn(TestEnvironment::getIpVersionsForTest()),
TestUtility::ipTestParamsToString);
// TODO(#14829) categorize or fix all failures.
#define EXCLUDE_UPSTREAM_HTTP3 \
if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { \
return; \
}

INSTANTIATE_TEST_SUITE_P(Protocols, Http2UpstreamIntegrationTest,
testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams(
{Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP2})),
HttpProtocolIntegrationTest::protocolTestParamsToString);

// TODO(alyssawilk) move #defines into getProtocolTestParams in a follow-up
#ifdef ENVOY_ENABLE_QUIC
INSTANTIATE_TEST_SUITE_P(ProtocolsWithQuic, Http2UpstreamIntegrationTest,
testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams(
{Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP3})),
HttpProtocolIntegrationTest::protocolTestParamsToString);
#endif

TEST_P(Http2UpstreamIntegrationTest, RouterRequestAndResponseWithBodyNoBuffer) {
testRouterRequestAndResponseWithBody(1024, 512, false);
Expand All @@ -32,10 +47,12 @@ TEST_P(Http2UpstreamIntegrationTest, RouterHeaderOnlyRequestAndResponseNoBuffer)
}

TEST_P(Http2UpstreamIntegrationTest, RouterUpstreamDisconnectBeforeRequestcomplete) {
EXCLUDE_UPSTREAM_HTTP3; // Close loop.
testRouterUpstreamDisconnectBeforeRequestComplete();
}

TEST_P(Http2UpstreamIntegrationTest, RouterUpstreamDisconnectBeforeResponseComplete) {
EXCLUDE_UPSTREAM_HTTP3; // Close loop.
testRouterUpstreamDisconnectBeforeResponseComplete();
}

Expand All @@ -51,11 +68,20 @@ TEST_P(Http2UpstreamIntegrationTest, RouterUpstreamResponseBeforeRequestComplete
testRouterUpstreamResponseBeforeRequestComplete();
}

TEST_P(Http2UpstreamIntegrationTest, Retry) { testRetry(); }
TEST_P(Http2UpstreamIntegrationTest, Retry) {
EXCLUDE_UPSTREAM_HTTP3; // CHECK failed: max_plaintext_size_ (=18) >= PacketSize() (=20)
testRetry();
}

TEST_P(Http2UpstreamIntegrationTest, GrpcRetry) { testGrpcRetry(); }
TEST_P(Http2UpstreamIntegrationTest, GrpcRetry) {
EXCLUDE_UPSTREAM_HTTP3; // CHECK failed: max_plaintext_size_ (=18) >= PacketSize() (=20)
testGrpcRetry();
}

TEST_P(Http2UpstreamIntegrationTest, Trailers) { testTrailers(1024, 2048, true, true); }
TEST_P(Http2UpstreamIntegrationTest, Trailers) {
EXCLUDE_UPSTREAM_HTTP3; // CHECK failed: max_plaintext_size_ (=18) >= PacketSize() (=20)
testTrailers(1024, 2048, true, true);
}

TEST_P(Http2UpstreamIntegrationTest, TestSchemeAndXFP) {
autonomous_upstream_ = true;
Expand Down Expand Up @@ -290,21 +316,25 @@ TEST_P(Http2UpstreamIntegrationTest, ManySimultaneousRequest) {
}

TEST_P(Http2UpstreamIntegrationTest, ManyLargeSimultaneousRequestWithBufferLimits) {
EXCLUDE_UPSTREAM_HTTP3; // quic_stream_sequencer.cc:235 CHECK failed: !blocked_.
config_helper_.setBufferLimits(1024, 1024); // Set buffer limits upstream and downstream.
manySimultaneousRequests(1024 * 20, 1024 * 20);
}

TEST_P(Http2UpstreamIntegrationTest, ManyLargeSimultaneousRequestWithRandomBackup) {
config_helper_.addFilter(R"EOF(
name: random-pause-filter
EXCLUDE_UPSTREAM_HTTP3; // fails: no 200s.
config_helper_.addFilter(
fmt::format(R"EOF(
name: pause-filter{}
typed_config:
"@type": type.googleapis.com/google.protobuf.Empty
)EOF");
"@type": type.googleapis.com/google.protobuf.Empty)EOF",
downstreamProtocol() == Http::CodecClient::Type::HTTP3 ? "-for-quic" : ""));

manySimultaneousRequests(1024 * 20, 1024 * 20);
}

TEST_P(Http2UpstreamIntegrationTest, UpstreamConnectionCloseWithManyStreams) {
EXCLUDE_UPSTREAM_HTTP3; // Close loop.
config_helper_.setBufferLimits(1024, 1024); // Set buffer limits upstream and downstream.
const uint32_t num_requests = 20;
std::vector<Http::RequestEncoder*> encoders;
Expand Down Expand Up @@ -423,6 +453,8 @@ name: router
// Tests the default limit for the number of response headers is 100. Results in a stream reset if
// exceeds.
TEST_P(Http2UpstreamIntegrationTest, TestManyResponseHeadersRejected) {
EXCLUDE_UPSTREAM_HTTP3; // no 503.

// Default limit for response headers is 100.
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#pragma once

#include "test/integration/http_integration.h"
#include "test/integration/http_protocol_integration.h"

#include "gtest/gtest.h"

namespace Envoy {
class Http2UpstreamIntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
public HttpIntegrationTest {
class Http2UpstreamIntegrationTest : public HttpProtocolIntegrationTest {
public:
Http2UpstreamIntegrationTest()
: HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) {}

void SetUp() override {
setDownstreamProtocol(Http::CodecClient::Type::HTTP2);
setUpstreamProtocol(FakeHttpConnection::Type::HTTP2);
HttpProtocolIntegrationTest::SetUp();

upstream_tls_ = true;
config_helper_.configureUpstreamTls(use_alpn_);
config_helper_.configureUpstreamTls(use_alpn_,
upstreamProtocol() == FakeHttpConnection::Type::HTTP3);
}

void initialize() override { HttpIntegrationTest::initialize(); }
Expand Down
1 change: 0 additions & 1 deletion test/integration/protocol_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,6 @@ TEST_P(ProtocolIntegrationTest, EnvoyProxyingLateMultiple1xx) {
TEST_P(ProtocolIntegrationTest, TwoRequests) { testTwoRequests(); }

TEST_P(ProtocolIntegrationTest, TwoRequestsWithForcedBackup) {
// hits assert "Upper stream buffer limit is reached before response body is delivered."
EXCLUDE_UPSTREAM_HTTP3;
testTwoRequests(true);
}
Expand Down

0 comments on commit 2858cd2

Please sign in to comment.