Skip to content

Commit

Permalink
drop changes accommodating legacy h2 codec, it was removed
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Puncel <mpuncel@squareup.com>
  • Loading branch information
mpuncel committed Dec 16, 2020
1 parent d15bbf3 commit 31c0641
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
10 changes: 2 additions & 8 deletions test/common/http/http2/codec_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,8 @@ TEST_P(Http2CodecImplTest, ProtocolErrorForTest) {
// We have to dynamic cast because protocolErrorForTest() is intentionally not on the
// Connection API.
ServerConnectionImpl* raw_server = dynamic_cast<ServerConnectionImpl*>(server_.get());
if (raw_server != nullptr) {
EXPECT_EQ(StatusCode::CodecProtocolError, getStatusCode(raw_server->protocolErrorForTest()));
} else {
Envoy::Http::Legacy::Http2::ServerConnectionImpl* legacy_raw_server =
dynamic_cast<Envoy::Http::Legacy::Http2::ServerConnectionImpl*>(server_.get());
ASSERT(legacy_raw_server != nullptr);
legacy_raw_server->protocolErrorForTest();
}
ASSERT(raw_server != nullptr);
EXPECT_EQ(StatusCode::CodecProtocolError, getStatusCode(raw_server->protocolErrorForTest()));
}

// 100 response followed by 200 results in a [decode100ContinueHeaders, decodeHeaders] sequence.
Expand Down
21 changes: 5 additions & 16 deletions test/integration/fake_upstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,22 +388,11 @@ void FakeHttpConnection::encodeProtocolError() {

Http::Http2::ServerConnectionImpl* codec =
dynamic_cast<Http::Http2::ServerConnectionImpl*>(codec_.get());
if (codec != nullptr) {
shared_connection_.connection().dispatcher().post([codec]() {
Http::Status status = codec->protocolErrorForTest();
ASSERT(Http::getStatusCode(status) == Http::StatusCode::CodecProtocolError);
});
} else {
// Fall back to trying the Legacy ServerConnectionImpl which is used in certain test
// configurations, specifically the bazel.compile_time_options tests.
// TODO(mpuncel) remove this "else" case when the legacy codec is no longer used.
Http::Legacy::Http2::ServerConnectionImpl* legacy_codec =
dynamic_cast<Http::Legacy::Http2::ServerConnectionImpl*>(codec_.get());
ASSERT(legacy_codec != nullptr);

shared_connection_.connection().dispatcher().post(
[legacy_codec]() { legacy_codec->protocolErrorForTest(); });
}
ASSERT(codec != nullptr);
shared_connection_.connection().dispatcher().post([codec]() {
Http::Status status = codec->protocolErrorForTest();
ASSERT(Http::getStatusCode(status) == Http::StatusCode::CodecProtocolError);
});
}

AssertionResult FakeConnectionBase::waitForDisconnect(milliseconds timeout) {
Expand Down

0 comments on commit 31c0641

Please sign in to comment.