From 7ba1f6276ddbc77d5ab39941f9b4c1846c695ad8 Mon Sep 17 00:00:00 2001 From: Alyssa Wilk Date: Thu, 20 May 2021 15:12:50 -0400 Subject: [PATCH 1/2] http: unifying client types Signed-off-by: Alyssa Wilk --- include/envoy/http/codec.h | 2 + source/common/http/codec_client.cc | 14 +-- source/common/http/codec_client.h | 11 +- source/common/http/http1/conn_pool.cc | 6 +- source/common/http/http2/conn_pool.cc | 6 +- source/common/http/http3/conn_pool.cc | 6 +- source/common/http/mixed_conn_pool.cc | 3 +- source/common/tcp_proxy/upstream.cc | 4 +- source/common/tcp_proxy/upstream.h | 7 +- source/common/upstream/health_checker_impl.cc | 20 +-- source/common/upstream/health_checker_impl.h | 4 +- .../upstreams/tcp/generic/config.cc | 4 +- .../grpc_client_integration_test_harness.h | 4 +- test/common/http/codec_client_test.cc | 13 +- test/common/http/common.h | 2 +- test/common/http/http1/conn_pool_test.cc | 2 +- test/common/http/http2/conn_pool_test.cc | 2 +- test/common/upstream/health_check_fuzz.cc | 6 +- .../upstream/health_check_fuzz_test_utils.cc | 8 +- .../upstream/health_check_fuzz_test_utils.h | 2 +- .../upstream/health_checker_impl_test.cc | 24 ++-- .../http_grpc_access_log_integration_test.cc | 4 +- .../tcp_grpc_access_log_integration_test.cc | 2 +- .../access_log_integration_test.cc | 4 +- .../bootstrap/wasm/wasm_integration_test.cc | 4 +- .../aggregate/cluster_integration_test.cc | 11 +- ...tive_concurrency_filter_integration_test.h | 7 +- .../admission_control_integration_test.cc | 5 +- .../aws_lambda_filter_integration_test.cc | 5 +- .../http/cdn_loop/filter_integration_test.cc | 4 +- .../compressor_integration_tests.cc | 8 +- .../compressor/compressor_integration_tests.h | 2 +- .../composite_filter_integration_test.cc | 3 +- .../compressor_filter_integration_test.cc | 2 +- .../http/cors/cors_filter_integration_test.cc | 2 +- .../decompressor_filter_integration_test.cc | 4 +- .../proxy_filter_integration_test.cc | 6 +- .../ext_authz/ext_authz_integration_test.cc | 46 ++++--- .../ext_proc/ext_proc_integration_test.cc | 8 +- .../fault/fault_filter_integration_test.cc | 2 +- .../reverse_bridge_integration_test.cc | 13 +- .../grpc_json_transcoder_integration_test.cc | 9 +- .../grpc_web_filter_integration_test.cc | 28 ++--- .../http/gzip/gzip_filter_integration_test.cc | 2 +- .../kill_request/crash_integration_test.cc | 2 +- .../filters/http/lua/lua_integration_test.cc | 8 +- .../http/oauth2/oauth_integration_test.cc | 4 +- .../ratelimit/ratelimit_integration_test.cc | 4 +- .../http/router/auto_sni_integration_test.cc | 6 +- .../squash/squash_filter_integration_test.cc | 4 +- .../http/tap/tap_filter_integration_test.cc | 4 +- .../proxy_filter_integration_test.cc | 7 +- ...reserve_case_formatter_integration_test.cc | 2 +- .../host/previous_hosts/integration_test.cc | 2 +- .../hystrix/hystrix_integration_test.cc | 6 +- .../metrics_service_integration_test.cc | 5 +- .../alts/alts_integration_test.cc | 2 +- .../spiffe_validator_integration_test.h | 2 +- .../tls/integration/ssl_integration_test.cc | 6 +- .../tls/integration/ssl_integration_test.h | 2 +- test/integration/README.md | 2 +- test/integration/ads_integration.cc | 4 +- test/integration/ads_integration_test.cc | 14 +-- test/integration/alpn_integration_test.cc | 16 +-- .../alpn_selection_integration_test.cc | 11 +- test/integration/autonomous_upstream.cc | 3 +- test/integration/autonomous_upstream.h | 2 +- test/integration/base_integration_test.cc | 18 +-- test/integration/base_integration_test.h | 12 +- test/integration/cds_integration_test.cc | 10 +- ...ter_upstream_extension_integration_test.cc | 2 +- ...nd_formatter_extension_integration_test.cc | 2 +- .../custom_cluster_integration_test.cc | 3 +- .../direct_response_integration_test.cc | 3 +- .../drain_close_integration_test.cc | 10 +- .../dynamic_validation_integration_test.cc | 4 +- test/integration/eds_integration_test.cc | 4 +- .../extension_discovery_integration_test.cc | 7 +- test/integration/fake_upstream.cc | 24 ++-- test/integration/fake_upstream.h | 24 ++-- .../filter_manager_integration_test.cc | 9 +- test/integration/h1_fuzz.h | 2 +- .../h2_capture_direct_response_fuzz_test.cc | 4 +- test/integration/h2_capture_fuzz_test.cc | 4 +- test/integration/h2_fuzz.h | 2 +- test/integration/hds_integration_test.cc | 8 +- .../header_casing_integration_test.cc | 6 +- test/integration/header_integration_test.cc | 5 +- .../header_prefix_integration_test.cc | 4 +- .../health_check_integration_test.cc | 31 +++-- .../http2_flood_integration_test.cc | 12 +- test/integration/http_integration.cc | 77 ++++++------ test/integration/http_integration.h | 17 ++- test/integration/http_protocol_integration.cc | 24 ++-- test/integration/http_protocol_integration.h | 16 +-- .../http_subset_lb_integration_test.cc | 7 +- .../http_timeout_integration_test.cc | 2 +- .../http_timeout_integration_test.h | 6 +- .../http_typed_per_filter_config_test.cc | 2 +- .../idle_timeout_integration_test.cc | 6 +- .../instantiate_protocol_integration_test.cc | 4 +- test/integration/integration_admin_test.cc | 14 +-- test/integration/integration_test.cc | 2 +- test/integration/integration_test.h | 4 +- .../listener_lds_integration_test.cc | 6 +- .../load_stats_integration_test.cc | 4 +- .../local_reply_integration_test.cc | 16 +-- .../multiplexed_integration_test.cc | 14 +-- .../multiplexed_upstream_integration_test.cc | 18 +-- .../multiplexed_upstream_integration_test.h | 3 +- .../original_ip_detection_integration_test.cc | 3 +- test/integration/overload_integration_test.cc | 4 +- test/integration/protocol_integration_test.cc | 116 +++++++++--------- test/integration/protocol_integration_test.h | 2 +- .../proxy_proto_integration_test.cc | 2 +- .../integration/quic_http_integration_test.cc | 4 +- .../quic_protocol_integration_test.cc | 14 +-- test/integration/redirect_integration_test.cc | 4 +- test/integration/rtds_integration_test.cc | 4 +- .../scoped_rds_integration_test.cc | 6 +- .../sds_dynamic_integration_test.cc | 27 ++-- .../sds_generic_secret_integration_test.cc | 2 +- .../sds_static_integration_test.cc | 9 +- test/integration/server.cc | 2 +- .../integration/tcp_proxy_integration_test.cc | 4 +- .../tcp_tunneling_integration_test.cc | 60 +++++---- ...transport_socket_match_integration_test.cc | 7 +- test/integration/uds_integration_test.h | 6 +- test/integration/utility.cc | 9 +- test/integration/utility.h | 13 +- test/integration/version_integration_test.cc | 2 +- test/integration/vhds_integration_test.cc | 14 +-- .../integration/websocket_integration_test.cc | 24 ++-- test/integration/websocket_integration_test.h | 8 +- test/integration/xds_integration_test.cc | 9 +- test/integration/xfcc_integration_test.cc | 2 +- test/integration/xfcc_integration_test.h | 2 +- test/server/config_validation/xds_fuzz.cc | 4 +- 138 files changed, 614 insertions(+), 650 deletions(-) diff --git a/include/envoy/http/codec.h b/include/envoy/http/codec.h index 9e91a4d9df4a0..9a926c9a17421 100644 --- a/include/envoy/http/codec.h +++ b/include/envoy/http/codec.h @@ -19,6 +19,8 @@ namespace Envoy { namespace Http { +enum class CodecType { HTTP1, HTTP2, HTTP3 }; + namespace Http1 { struct CodecStats; } diff --git a/source/common/http/codec_client.cc b/source/common/http/codec_client.cc index 3353ff81d0904..0b21cf4bc6939 100644 --- a/source/common/http/codec_client.cc +++ b/source/common/http/codec_client.cc @@ -20,12 +20,12 @@ namespace Envoy { namespace Http { -CodecClient::CodecClient(Type type, Network::ClientConnectionPtr&& connection, +CodecClient::CodecClient(CodecType type, Network::ClientConnectionPtr&& connection, Upstream::HostDescriptionConstSharedPtr host, Event::Dispatcher& dispatcher) : type_(type), host_(host), connection_(std::move(connection)), idle_timeout_(host_->cluster().idleTimeout()) { - if (type_ != Type::HTTP3) { + if (type_ != CodecType::HTTP3) { // Make sure upstream connections process data and then the FIN, rather than processing // TCP disconnects immediately. (see https://github.com/envoyproxy/envoy/issues/1679 for // details) @@ -95,7 +95,7 @@ void CodecClient::onEvent(Network::ConnectionEvent event) { } // HTTP/1 can signal end of response by disconnecting. We need to handle that case. - if (type_ == Type::HTTP1 && event == Network::ConnectionEvent::RemoteClose && + if (type_ == CodecType::HTTP1 && event == Network::ConnectionEvent::RemoteClose && !active_requests_.empty()) { Buffer::OwnedImpl empty; onData(empty); @@ -169,26 +169,26 @@ void CodecClient::onData(Buffer::Instance& data) { absl::StrCat("extraneous bytes after response complete: ", data.length())); } -CodecClientProd::CodecClientProd(Type type, Network::ClientConnectionPtr&& connection, +CodecClientProd::CodecClientProd(CodecType type, Network::ClientConnectionPtr&& connection, Upstream::HostDescriptionConstSharedPtr host, Event::Dispatcher& dispatcher, Random::RandomGenerator& random_generator) : CodecClient(type, std::move(connection), host, dispatcher) { switch (type) { - case Type::HTTP1: { + case CodecType::HTTP1: { codec_ = std::make_unique( *connection_, host->cluster().http1CodecStats(), *this, host->cluster().http1Settings(), host->cluster().maxResponseHeadersCount()); break; } - case Type::HTTP2: { + case CodecType::HTTP2: { codec_ = std::make_unique( *connection_, *this, host->cluster().http2CodecStats(), random_generator, host->cluster().http2Options(), Http::DEFAULT_MAX_REQUEST_HEADERS_KB, host->cluster().maxResponseHeadersCount(), Http2::ProdNghttp2SessionFactory::get()); break; } - case Type::HTTP3: { + case CodecType::HTTP3: { #ifdef ENVOY_ENABLE_QUIC auto& quic_session = dynamic_cast(*connection_); codec_ = std::make_unique( diff --git a/source/common/http/codec_client.h b/source/common/http/codec_client.h index 07eb9724d607a..b2cb841010d65 100644 --- a/source/common/http/codec_client.h +++ b/source/common/http/codec_client.h @@ -55,7 +55,8 @@ class CodecClient : protected Logger::Loggable, /** * Type of HTTP codec to use. */ - enum class Type { HTTP1, HTTP2, HTTP3 }; + // This is a legacy alias. + using Type = Envoy::Http::CodecType; ~CodecClient() override; @@ -125,7 +126,7 @@ class CodecClient : protected Logger::Loggable, bool remoteClosed() const { return remote_closed_; } - Type type() const { return type_; } + CodecType type() const { return type_; } // Note this is the L4 stream info, not L7. const StreamInfo::StreamInfo& streamInfo() { return connection_->streamInfo(); } @@ -137,7 +138,7 @@ class CodecClient : protected Logger::Loggable, * @param connection supplies the connection to communicate on. * @param host supplies the owning host. */ - CodecClient(Type type, Network::ClientConnectionPtr&& connection, + CodecClient(CodecType type, Network::ClientConnectionPtr&& connection, Upstream::HostDescriptionConstSharedPtr host, Event::Dispatcher& dispatcher); /** @@ -175,7 +176,7 @@ class CodecClient : protected Logger::Loggable, } } - const Type type_; + const CodecType type_; // The order of host_, connection_, and codec_ matter as during destruction each can refer to // the previous, at least in tests. Upstream::HostDescriptionConstSharedPtr host_; @@ -273,7 +274,7 @@ using CodecClientPtr = std::unique_ptr; */ class CodecClientProd : public CodecClient { public: - CodecClientProd(Type type, Network::ClientConnectionPtr&& connection, + CodecClientProd(CodecType type, Network::ClientConnectionPtr&& connection, Upstream::HostDescriptionConstSharedPtr host, Event::Dispatcher& dispatcher, Random::RandomGenerator& random_generator); }; diff --git a/source/common/http/http1/conn_pool.cc b/source/common/http/http1/conn_pool.cc index 8a59c01005572..db90cfc87a48b 100644 --- a/source/common/http/http1/conn_pool.cc +++ b/source/common/http/http1/conn_pool.cc @@ -108,9 +108,9 @@ allocateConnPool(Event::Dispatcher& dispatcher, Random::RandomGenerator& random_ random_generator, state, [](HttpConnPoolImplBase* pool) { return std::make_unique(*pool); }, [](Upstream::Host::CreateConnectionData& data, HttpConnPoolImplBase* pool) { - CodecClientPtr codec{new CodecClientProd( - CodecClient::Type::HTTP1, std::move(data.connection_), data.host_description_, - pool->dispatcher(), pool->randomGenerator())}; + CodecClientPtr codec{new CodecClientProd(CodecType::HTTP1, std::move(data.connection_), + data.host_description_, pool->dispatcher(), + pool->randomGenerator())}; return codec; }, std::vector{Protocol::Http11}); diff --git a/source/common/http/http2/conn_pool.cc b/source/common/http/http2/conn_pool.cc index fe8dca2c4247f..bc137ba39a8f9 100644 --- a/source/common/http/http2/conn_pool.cc +++ b/source/common/http/http2/conn_pool.cc @@ -33,9 +33,9 @@ allocateConnPool(Event::Dispatcher& dispatcher, Random::RandomGenerator& random_ host, priority, dispatcher, options, transport_socket_options, random_generator, state, [](HttpConnPoolImplBase* pool) { return std::make_unique(*pool); }, [](Upstream::Host::CreateConnectionData& data, HttpConnPoolImplBase* pool) { - CodecClientPtr codec{new CodecClientProd( - CodecClient::Type::HTTP2, std::move(data.connection_), data.host_description_, - pool->dispatcher(), pool->randomGenerator())}; + CodecClientPtr codec{new CodecClientProd(CodecType::HTTP2, std::move(data.connection_), + data.host_description_, pool->dispatcher(), + pool->randomGenerator())}; return codec; }, std::vector{Protocol::Http2}); diff --git a/source/common/http/http3/conn_pool.cc b/source/common/http/http3/conn_pool.cc index 3f1fbcbe5c1a1..6b68210896726 100644 --- a/source/common/http/http3/conn_pool.cc +++ b/source/common/http/http3/conn_pool.cc @@ -85,9 +85,9 @@ allocateConnPool(Event::Dispatcher& dispatcher, Random::RandomGenerator& random_ return std::make_unique(*pool, data); }, [](Upstream::Host::CreateConnectionData& data, HttpConnPoolImplBase* pool) { - CodecClientPtr codec{new CodecClientProd( - CodecClient::Type::HTTP3, std::move(data.connection_), data.host_description_, - pool->dispatcher(), pool->randomGenerator())}; + CodecClientPtr codec{new CodecClientProd(CodecType::HTTP3, std::move(data.connection_), + data.host_description_, pool->dispatcher(), + pool->randomGenerator())}; return codec; }, std::vector{Protocol::Http3}, time_source); diff --git a/source/common/http/mixed_conn_pool.cc b/source/common/http/mixed_conn_pool.cc index 26322fb992e9d..07fcfea475aee 100644 --- a/source/common/http/mixed_conn_pool.cc +++ b/source/common/http/mixed_conn_pool.cc @@ -16,8 +16,7 @@ Envoy::ConnectionPool::ActiveClientPtr HttpConnPoolImplMixed::instantiateActiveC CodecClientPtr HttpConnPoolImplMixed::createCodecClient(Upstream::Host::CreateConnectionData& data) { - auto protocol = - protocol_ == Protocol::Http11 ? CodecClient::Type::HTTP1 : CodecClient::Type::HTTP2; + auto protocol = protocol_ == Protocol::Http11 ? CodecType::HTTP1 : CodecType::HTTP2; CodecClientPtr codec{new CodecClientProd(protocol, std::move(data.connection_), data.host_description_, dispatcher_, random_generator_)}; return codec; diff --git a/source/common/tcp_proxy/upstream.cc b/source/common/tcp_proxy/upstream.cc index fc0335775afdb..22b939a30bc47 100644 --- a/source/common/tcp_proxy/upstream.cc +++ b/source/common/tcp_proxy/upstream.cc @@ -193,7 +193,7 @@ void TcpConnPool::onPoolReady(Tcp::ConnectionPool::ConnectionDataPtr&& conn_data HttpConnPool::HttpConnPool(Upstream::ThreadLocalCluster& thread_local_cluster, Upstream::LoadBalancerContext* context, const TunnelingConfig& config, Tcp::ConnectionPool::UpstreamCallbacks& upstream_callbacks, - Http::CodecClient::Type type) + Http::CodecType type) : config_(config), type_(type), upstream_callbacks_(upstream_callbacks) { conn_pool_ = thread_local_cluster.httpConnPool(Upstream::ResourcePriority::Default, absl::nullopt, context); @@ -209,7 +209,7 @@ HttpConnPool::~HttpConnPool() { void HttpConnPool::newStream(GenericConnectionPoolCallbacks& callbacks) { callbacks_ = &callbacks; - if (type_ == Http::CodecClient::Type::HTTP1) { + if (type_ == Http::CodecType::HTTP1) { upstream_ = std::make_unique(upstream_callbacks_, config_); } else { upstream_ = std::make_unique(upstream_callbacks_, config_); diff --git a/source/common/tcp_proxy/upstream.h b/source/common/tcp_proxy/upstream.h index bdf31648b034d..3047441a9a4fb 100644 --- a/source/common/tcp_proxy/upstream.h +++ b/source/common/tcp_proxy/upstream.h @@ -48,12 +48,11 @@ class HttpConnPool : public GenericConnPool, public Http::ConnectionPool::Callba HttpConnPool(Upstream::ThreadLocalCluster& thread_local_cluster, Upstream::LoadBalancerContext* context, const TunnelingConfig& config, - Tcp::ConnectionPool::UpstreamCallbacks& upstream_callbacks, - Http::CodecClient::Type type); + Tcp::ConnectionPool::UpstreamCallbacks& upstream_callbacks, Http::CodecType type); ~HttpConnPool() override; // HTTP/3 upstreams are not supported at the moment. - bool valid() const { return conn_pool_ != nullptr && type_ <= Http::CodecClient::Type::HTTP2; } + bool valid() const { return conn_pool_ != nullptr && type_ <= Http::CodecType::HTTP2; } // GenericConnPool void newStream(GenericConnectionPoolCallbacks& callbacks) override; @@ -97,7 +96,7 @@ class HttpConnPool : public GenericConnPool, public Http::ConnectionPool::Callba const Network::Address::InstanceConstSharedPtr& local_address, Ssl::ConnectionInfoConstSharedPtr ssl_info); const TunnelingConfig config_; - Http::CodecClient::Type type_; + Http::CodecType type_; Http::ConnectionPool::Instance* conn_pool_{}; Http::ConnectionPool::Cancellable* upstream_handle_{}; GenericConnectionPoolCallbacks* callbacks_{}; diff --git a/source/common/upstream/health_checker_impl.cc b/source/common/upstream/health_checker_impl.cc index 7b64ed5fda851..608c02e2b7a22 100644 --- a/source/common/upstream/health_checker_impl.cc +++ b/source/common/upstream/health_checker_impl.cc @@ -197,13 +197,13 @@ bool HttpHealthCheckerImpl::HttpStatusChecker::inRange(uint64_t http_status) con return false; } -Http::Protocol codecClientTypeToProtocol(Http::CodecClient::Type codec_client_type) { +Http::Protocol codecClientTypeToProtocol(Http::CodecType codec_client_type) { switch (codec_client_type) { - case Http::CodecClient::Type::HTTP1: + case Http::CodecType::HTTP1: return Http::Protocol::Http11; - case Http::CodecClient::Type::HTTP2: + case Http::CodecType::HTTP2: return Http::Protocol::Http2; - case Http::CodecClient::Type::HTTP3: + case Http::CodecType::HTTP3: return Http::Protocol::Http3; default: NOT_REACHED_GCOVR_EXCL_LINE; @@ -422,15 +422,15 @@ void HttpHealthCheckerImpl::HttpActiveHealthCheckSession::onTimeout() { } } -Http::CodecClient::Type +Http::CodecType HttpHealthCheckerImpl::codecClientType(const envoy::type::v3::CodecClientType& type) { switch (type) { case envoy::type::v3::HTTP3: - return Http::CodecClient::Type::HTTP3; + return Http::CodecType::HTTP3; case envoy::type::v3::HTTP2: - return Http::CodecClient::Type::HTTP2; + return Http::CodecType::HTTP2; case envoy::type::v3::HTTP1: - return Http::CodecClient::Type::HTTP1; + return Http::CodecType::HTTP1; default: NOT_REACHED_GCOVR_EXCL_LINE; } @@ -892,8 +892,8 @@ void GrpcHealthCheckerImpl::GrpcActiveHealthCheckSession::logHealthCheckStatus( Http::CodecClientPtr ProdGrpcHealthCheckerImpl::createCodecClient(Upstream::Host::CreateConnectionData& data) { return std::make_unique( - Http::CodecClient::Type::HTTP2, std::move(data.connection_), data.host_description_, - dispatcher_, random_generator_); + Http::CodecType::HTTP2, std::move(data.connection_), data.host_description_, dispatcher_, + random_generator_); } std::ostream& operator<<(std::ostream& out, HealthState state) { diff --git a/source/common/upstream/health_checker_impl.h b/source/common/upstream/health_checker_impl.h index a156c77f9847f..fdc337d142f6d 100644 --- a/source/common/upstream/health_checker_impl.h +++ b/source/common/upstream/health_checker_impl.h @@ -159,7 +159,7 @@ class HttpHealthCheckerImpl : public HealthCheckerImplBase { return envoy::data::core::v3::HTTP; } - Http::CodecClient::Type codecClientType(const envoy::type::v3::CodecClientType& type); + Http::CodecType codecClientType(const envoy::type::v3::CodecClientType& type); const std::string path_; const std::string host_value_; @@ -168,7 +168,7 @@ class HttpHealthCheckerImpl : public HealthCheckerImplBase { const HttpStatusChecker http_status_checker_; protected: - const Http::CodecClient::Type codec_client_type_; + const Http::CodecType codec_client_type_; Random::RandomGenerator& random_generator_; }; diff --git a/source/extensions/upstreams/tcp/generic/config.cc b/source/extensions/upstreams/tcp/generic/config.cc index 1a71c3c5bc04b..7d708c4a666a1 100644 --- a/source/extensions/upstreams/tcp/generic/config.cc +++ b/source/extensions/upstreams/tcp/generic/config.cc @@ -18,8 +18,8 @@ TcpProxy::GenericConnPoolPtr GenericConnPoolFactory::createGenericConnPool( if (config.has_value()) { auto pool_type = ((thread_local_cluster.info()->features() & Upstream::ClusterInfo::Features::HTTP2) != 0) - ? Http::CodecClient::Type::HTTP2 - : Http::CodecClient::Type::HTTP1; + ? Http::CodecType::HTTP2 + : Http::CodecType::HTTP1; auto ret = std::make_unique( thread_local_cluster, context, config.value(), upstream_callbacks, pool_type); return (ret->valid() ? std::move(ret) : nullptr); diff --git a/test/common/grpc/grpc_client_integration_test_harness.h b/test/common/grpc/grpc_client_integration_test_harness.h index 7a611435607c1..3145e6b89b84a 100644 --- a/test/common/grpc/grpc_client_integration_test_harness.h +++ b/test/common/grpc/grpc_client_integration_test_harness.h @@ -246,7 +246,7 @@ class GrpcClientIntegrationTest : public GrpcClientIntegrationParamTest { virtual void initialize() { if (fake_upstream_ == nullptr) { FakeUpstreamConfig config(test_time_.timeSystem()); - config.upstream_protocol_ = FakeHttpConnection::Type::HTTP2; + config.upstream_protocol_ = Http::CodecType::HTTP2; fake_upstream_ = std::make_unique(0, ipVersion(), config); } switch (clientType()) { @@ -524,7 +524,7 @@ class GrpcSslClientIntegrationTest : public GrpcClientIntegrationTest { async_client_transport_socket_ = mock_host_description_->socket_factory_->createTransportSocket(nullptr); FakeUpstreamConfig config(test_time_.timeSystem()); - config.upstream_protocol_ = FakeHttpConnection::Type::HTTP2; + config.upstream_protocol_ = Http::CodecType::HTTP2; fake_upstream_ = std::make_unique(createUpstreamSslContext(), 0, ipVersion(), config); diff --git a/test/common/http/codec_client_test.cc b/test/common/http/codec_client_test.cc index 4f601a5a45619..ece5c89d02639 100644 --- a/test/common/http/codec_client_test.cc +++ b/test/common/http/codec_client_test.cc @@ -57,8 +57,8 @@ class CodecClientTest : public Event::TestUsingSimulatedTime, public testing::Te Network::ClientConnectionPtr connection{connection_}; EXPECT_CALL(dispatcher_, createTimer_(_)); - client_ = std::make_unique(CodecClient::Type::HTTP1, std::move(connection), - codec_, nullptr, host_, dispatcher_); + client_ = std::make_unique(CodecType::HTTP1, std::move(connection), codec_, + nullptr, host_, dispatcher_); ON_CALL(*connection_, streamInfo()).WillByDefault(ReturnRef(stream_info_)); } @@ -88,8 +88,8 @@ TEST_F(CodecClientTest, NotCallDetectEarlyCloseWhenReadDiabledUsingHttp3) { auto codec = new Http::MockClientConnection(); EXPECT_CALL(dispatcher_, createTimer_(_)); - client_ = std::make_unique(CodecClient::Type::HTTP3, std::move(connection), - codec, nullptr, host_, dispatcher_); + client_ = std::make_unique(CodecType::HTTP3, std::move(connection), codec, + nullptr, host_, dispatcher_); } TEST_F(CodecClientTest, BasicHeaderOnlyResponse) { @@ -309,9 +309,8 @@ class CodecNetworkTest : public Event::TestUsingSimulatedTime, client_connection_->addConnectionCallbacks(client_callbacks_); codec_ = new Http::MockClientConnection(); - client_ = - std::make_unique(CodecClient::Type::HTTP1, std::move(client_connection), - codec_, nullptr, host_, *dispatcher_); + client_ = std::make_unique(CodecType::HTTP1, std::move(client_connection), + codec_, nullptr, host_, *dispatcher_); int expected_callbacks = 2; EXPECT_CALL(listener_callbacks_, onAccept_(_)) diff --git a/test/common/http/common.h b/test/common/http/common.h index 3a28e9b369b87..06385cbc6c12a 100644 --- a/test/common/http/common.h +++ b/test/common/http/common.h @@ -17,7 +17,7 @@ namespace Envoy { class CodecClientForTest : public Http::CodecClient { public: using DestroyCb = std::function; - CodecClientForTest(CodecClient::Type type, Network::ClientConnectionPtr&& connection, + CodecClientForTest(Http::CodecType type, Network::ClientConnectionPtr&& connection, Http::ClientConnection* codec, DestroyCb destroy_cb, Upstream::HostDescriptionConstSharedPtr host, Event::Dispatcher& dispatcher) : CodecClient(type, std::move(connection), host, dispatcher), destroy_cb_(destroy_cb) { diff --git a/test/common/http/http1/conn_pool_test.cc b/test/common/http/http1/conn_pool_test.cc index fee006d726d35..2c461685b04e7 100644 --- a/test/common/http/http1/conn_pool_test.cc +++ b/test/common/http/http1/conn_pool_test.cc @@ -106,7 +106,7 @@ class ConnPoolImplForTest : public Event::TestUsingSimulatedTime, public FixedHt test_client.client_dispatcher_ = api_->allocateDispatcher("test_thread"); Network::ClientConnectionPtr connection{test_client.connection_}; test_client.codec_client_ = new CodecClientForTest( - CodecClient::Type::HTTP1, std::move(connection), test_client.codec_, + CodecType::HTTP1, std::move(connection), test_client.codec_, [this](CodecClient* codec_client) -> void { for (auto i = test_clients_.begin(); i != test_clients_.end(); i++) { if (i->codec_client_ == codec_client) { diff --git a/test/common/http/http2/conn_pool_test.cc b/test/common/http/http2/conn_pool_test.cc index d8b34b43b63d0..f29d0d83209eb 100644 --- a/test/common/http/http2/conn_pool_test.cc +++ b/test/common/http/http2/conn_pool_test.cc @@ -131,7 +131,7 @@ class Http2ConnPoolImplTest : public Event::TestUsingSimulatedTime, public testi auto cluster = std::make_shared>(); Network::ClientConnectionPtr connection{test_client.connection_}; test_client.codec_client_ = new CodecClientForTest( - CodecClient::Type::HTTP1, std::move(connection), test_client.codec_, + CodecType::HTTP1, std::move(connection), test_client.codec_, [this](CodecClient*) -> void { onClientDestroy(); }, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", simTime()), *test_client.client_dispatcher_); diff --git a/test/common/upstream/health_check_fuzz.cc b/test/common/upstream/health_check_fuzz.cc index d2e37392b296e..6a14b35fe3b9c 100644 --- a/test/common/upstream/health_check_fuzz.cc +++ b/test/common/upstream/health_check_fuzz.cc @@ -343,9 +343,9 @@ void GrpcHealthCheckFuzz::initialize(test::common::upstream::HealthCheckTestCase Event::MockDispatcher dispatcher_; auto time_source = std::make_unique>(); test_session.codec_client_ = new CodecClientForTest( - Http::CodecClient::Type::HTTP1, std::move(conn_data.connection_), - test_session.codec_, nullptr, - Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", *time_source), dispatcher_); + Http::CodecType::HTTP1, std::move(conn_data.connection_), test_session.codec_, + nullptr, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", *time_source), + dispatcher_); return test_session.codec_client_; })); expectStreamCreate(); diff --git a/test/common/upstream/health_check_fuzz_test_utils.cc b/test/common/upstream/health_check_fuzz_test_utils.cc index e67e5f7a6cf06..0bfae721dca7b 100644 --- a/test/common/upstream/health_check_fuzz_test_utils.cc +++ b/test/common/upstream/health_check_fuzz_test_utils.cc @@ -52,8 +52,8 @@ void HttpHealthCheckerImplTestBase::expectClientCreate( new NiceMock()}; Event::MockDispatcher dispatcher_; test_session.codec_client_ = new CodecClientForTest( - Http::CodecClient::Type::HTTP1, std::move(conn_data.connection_), - test_session.codec_, nullptr, + Http::CodecType::HTTP1, std::move(conn_data.connection_), test_session.codec_, + nullptr, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", dispatcher_.timeSource()), dispatcher_); return test_session.codec_client_; @@ -129,8 +129,8 @@ void GrpcHealthCheckerImplTestBaseUtils::expectClientCreate(size_t index) { Event::MockDispatcher dispatcher_; test_session.codec_client_ = new CodecClientForTest( - Http::CodecClient::Type::HTTP1, std::move(conn_data.connection_), - test_session.codec_, nullptr, + Http::CodecType::HTTP1, std::move(conn_data.connection_), test_session.codec_, + nullptr, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", dispatcher_.timeSource()), dispatcher_); return test_session.codec_client_; diff --git a/test/common/upstream/health_check_fuzz_test_utils.h b/test/common/upstream/health_check_fuzz_test_utils.h index afc9b0a86cf15..833df01ad95ec 100644 --- a/test/common/upstream/health_check_fuzz_test_utils.h +++ b/test/common/upstream/health_check_fuzz_test_utils.h @@ -37,7 +37,7 @@ class TestHttpHealthCheckerImpl : public HttpHealthCheckerImpl { // HttpHealthCheckerImpl MOCK_METHOD(Http::CodecClient*, createCodecClient_, (Upstream::Host::CreateConnectionData&)); - Http::CodecClient::Type codecClientType() { return codec_client_type_; } + Http::CodecType codecClientType() { return codec_client_type_; } }; class HttpHealthCheckerImplTestBase : public HealthCheckerTestBase { diff --git a/test/common/upstream/health_checker_impl_test.cc b/test/common/upstream/health_checker_impl_test.cc index efb4b3b6c9615..5cba4b980a27c 100644 --- a/test/common/upstream/health_checker_impl_test.cc +++ b/test/common/upstream/health_checker_impl_test.cc @@ -124,7 +124,7 @@ class TestHttpHealthCheckerImpl : public HttpHealthCheckerImpl { // HttpHealthCheckerImpl MOCK_METHOD(Http::CodecClient*, createCodecClient_, (Upstream::Host::CreateConnectionData&)); - Http::CodecClient::Type codecClientType() { return codec_client_type_; } + Http::CodecType codecClientType() { return codec_client_type_; } }; class HttpHealthCheckerImplTest : public Event::TestUsingSimulatedTime, @@ -584,9 +584,9 @@ class HttpHealthCheckerImplTest : public Event::TestUsingSimulatedTime, new NiceMock()}; Event::MockDispatcher dispatcher_; test_session.codec_client_ = new CodecClientForTest( - Http::CodecClient::Type::HTTP1, std::move(conn_data.connection_), - test_session.codec_, nullptr, - Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", simTime()), dispatcher_); + Http::CodecType::HTTP1, std::move(conn_data.connection_), test_session.codec_, + nullptr, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", simTime()), + dispatcher_); return test_session.codec_client_; })); } @@ -2530,7 +2530,7 @@ TEST_F(HttpHealthCheckerImplTest, SuccessWithMultipleHostsAndAltPort) { TEST_F(HttpHealthCheckerImplTest, Http2ClusterUseHttp2CodecClient) { setupNoServiceValidationHCWithHttp2(); - EXPECT_EQ(Http::CodecClient::Type::HTTP2, health_checker_->codecClientType()); + EXPECT_EQ(Http::CodecType::HTTP2, health_checker_->codecClientType()); } MATCHER_P(MetadataEq, expected, "") { @@ -3006,7 +3006,7 @@ class ProdHttpHealthCheckerTest : public testing::Test, public HealthCheckerTest TEST_F(ProdHttpHealthCheckerTest, ProdHttpHealthCheckerH1HealthChecking) { setupNoServiceValidationHC(); - EXPECT_EQ(Http::CodecClient::Type::HTTP1, + EXPECT_EQ(Http::CodecType::HTTP1, health_checker_->createCodecClientForTest(std::move(connection_))->type()); } @@ -3028,7 +3028,7 @@ TEST_F(HttpHealthCheckerImplTest, DEPRECATED_FEATURE_TEST(Http1CodecClient)) { allocHealthChecker(yaml, false); addCompletionCallback(); - EXPECT_EQ(Http::CodecClient::Type::HTTP1, health_checker_->codecClientType()); + EXPECT_EQ(Http::CodecType::HTTP1, health_checker_->codecClientType()); } TEST_F(HttpHealthCheckerImplTest, DEPRECATED_FEATURE_TEST(Http2CodecClient)) { @@ -3049,7 +3049,7 @@ TEST_F(HttpHealthCheckerImplTest, DEPRECATED_FEATURE_TEST(Http2CodecClient)) { allocHealthChecker(yaml, false); addCompletionCallback(); - EXPECT_EQ(Http::CodecClient::Type::HTTP2, health_checker_->codecClientType()); + EXPECT_EQ(Http::CodecType::HTTP2, health_checker_->codecClientType()); } TEST_F(HttpHealthCheckerImplTest, DEPRECATED_FEATURE_TEST(ServiceNameMatch)) { @@ -3120,7 +3120,7 @@ TEST_F(HttpHealthCheckerImplTest, DEPRECATED_FEATURE_TEST(ServiceNameMismatch)) TEST_F(ProdHttpHealthCheckerTest, ProdHttpHealthCheckerH2HealthChecking) { setupNoServiceValidationHCWithHttp2(); - EXPECT_EQ(Http::CodecClient::Type::HTTP2, + EXPECT_EQ(Http::CodecType::HTTP2, health_checker_->createCodecClientForTest(std::move(connection_))->type()); } @@ -4122,9 +4122,9 @@ class GrpcHealthCheckerImplTestBase : public Event::TestUsingSimulatedTime, Event::MockDispatcher dispatcher_; test_session.codec_client_ = new CodecClientForTest( - Http::CodecClient::Type::HTTP1, std::move(conn_data.connection_), - test_session.codec_, nullptr, - Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", simTime()), dispatcher_); + Http::CodecType::HTTP1, std::move(conn_data.connection_), test_session.codec_, + nullptr, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000", simTime()), + dispatcher_); return test_session.codec_client_; })); } diff --git a/test/extensions/access_loggers/grpc/http_grpc_access_log_integration_test.cc b/test/extensions/access_loggers/grpc/http_grpc_access_log_integration_test.cc index eb594fd1b9935..f2daefe122107 100644 --- a/test/extensions/access_loggers/grpc/http_grpc_access_log_integration_test.cc +++ b/test/extensions/access_loggers/grpc/http_grpc_access_log_integration_test.cc @@ -22,11 +22,11 @@ namespace { class AccessLogIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, public HttpIntegrationTest { public: - AccessLogIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + AccessLogIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void initialize() override { diff --git a/test/extensions/access_loggers/grpc/tcp_grpc_access_log_integration_test.cc b/test/extensions/access_loggers/grpc/tcp_grpc_access_log_integration_test.cc index 51fc54f02d781..0e700eb4603ea 100644 --- a/test/extensions/access_loggers/grpc/tcp_grpc_access_log_integration_test.cc +++ b/test/extensions/access_loggers/grpc/tcp_grpc_access_log_integration_test.cc @@ -34,7 +34,7 @@ class TcpGrpcAccessLogIntegrationTest : public Grpc::VersionedGrpcClientIntegrat void createUpstreams() override { BaseIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void initialize() override { diff --git a/test/extensions/access_loggers/open_telemetry/access_log_integration_test.cc b/test/extensions/access_loggers/open_telemetry/access_log_integration_test.cc index 107572c662d6f..eead9606d55b1 100644 --- a/test/extensions/access_loggers/open_telemetry/access_log_integration_test.cc +++ b/test/extensions/access_loggers/open_telemetry/access_log_integration_test.cc @@ -49,11 +49,11 @@ namespace { class AccessLogIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, public HttpIntegrationTest { public: - AccessLogIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + AccessLogIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void initialize() override { diff --git a/test/extensions/bootstrap/wasm/wasm_integration_test.cc b/test/extensions/bootstrap/wasm/wasm_integration_test.cc index 197a45c24ca31..28b8b9dbb31c0 100644 --- a/test/extensions/bootstrap/wasm/wasm_integration_test.cc +++ b/test/extensions/bootstrap/wasm/wasm_integration_test.cc @@ -13,11 +13,11 @@ namespace { class WasmIntegrationTest : public HttpIntegrationTest, public testing::TestWithParam { public: WasmIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, Network::Address::IpVersion::v4) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, Network::Address::IpVersion::v4) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); } void cleanup() { diff --git a/test/extensions/clusters/aggregate/cluster_integration_test.cc b/test/extensions/clusters/aggregate/cluster_integration_test.cc index 16a1297d0a4db..b2181452bca61 100644 --- a/test/extensions/clusters/aggregate/cluster_integration_test.cc +++ b/test/extensions/clusters/aggregate/cluster_integration_test.cc @@ -124,8 +124,7 @@ const std::string& config() { class AggregateIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - AggregateIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), config()) { + AggregateIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam(), config()) { use_lds_ = false; } @@ -133,14 +132,14 @@ class AggregateIntegrationTest : public testing::TestWithParamlocalAddress()->ip()->port(), Network::Test::getLoopbackAddressString(GetParam())); diff --git a/test/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter_integration_test.h b/test/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter_integration_test.h index 264469ff43e1e..35a107450298e 100644 --- a/test/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter_integration_test.h +++ b/test/extensions/filters/http/adaptive_concurrency/adaptive_concurrency_filter_integration_test.h @@ -36,12 +36,11 @@ class AdaptiveConcurrencyIntegrationTest public Event::TestUsingSimulatedTime, public HttpIntegrationTest { public: - AdaptiveConcurrencyIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) {} + AdaptiveConcurrencyIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) {} void customInit() { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); config_helper_.addFilter(ADAPTIVE_CONCURRENCY_CONFIG); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); diff --git a/test/extensions/filters/http/admission_control/admission_control_integration_test.cc b/test/extensions/filters/http/admission_control/admission_control_integration_test.cc index 3535a136f58b6..a7e8d83f97cfb 100644 --- a/test/extensions/filters/http/admission_control/admission_control_integration_test.cc +++ b/test/extensions/filters/http/admission_control/admission_control_integration_test.cc @@ -33,8 +33,7 @@ class AdmissionControlIntegrationTest : public Event::TestUsingSimulatedTime, public testing::TestWithParam, public HttpIntegrationTest { public: - AdmissionControlIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + AdmissionControlIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void SetUp() override {} @@ -133,7 +132,7 @@ TEST_P(AdmissionControlIntegrationTest, HttpTest) { TEST_P(AdmissionControlIntegrationTest, GrpcTest) { autonomous_upstream_ = true; - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); initialize(); // Drop the success rate to a very low value. diff --git a/test/extensions/filters/http/aws_lambda/aws_lambda_filter_integration_test.cc b/test/extensions/filters/http/aws_lambda/aws_lambda_filter_integration_test.cc index 5f5816a7de6a8..db3227d9a2df4 100644 --- a/test/extensions/filters/http/aws_lambda/aws_lambda_filter_integration_test.cc +++ b/test/extensions/filters/http/aws_lambda/aws_lambda_filter_integration_test.cc @@ -16,15 +16,14 @@ namespace { class AwsLambdaFilterIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - AwsLambdaFilterIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) {} + AwsLambdaFilterIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) {} void SetUp() override { // Set these environment variables to quickly sign credentials instead of attempting to query // instance metadata and timing-out. TestEnvironment::setEnvVar("AWS_ACCESS_KEY_ID", "aws-user", 1 /*overwrite*/); TestEnvironment::setEnvVar("AWS_SECRET_ACCESS_KEY", "secret", 1 /*overwrite*/); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP1); + setUpstreamProtocol(Http::CodecType::HTTP1); } void TearDown() override { fake_upstream_connection_.reset(); } diff --git a/test/extensions/filters/http/cdn_loop/filter_integration_test.cc b/test/extensions/filters/http/cdn_loop/filter_integration_test.cc index a5db631c5c1ac..5e61749d0bf28 100644 --- a/test/extensions/filters/http/cdn_loop/filter_integration_test.cc +++ b/test/extensions/filters/http/cdn_loop/filter_integration_test.cc @@ -178,10 +178,10 @@ TEST_P(CdnLoopFilterIntegrationTest, CdnLoop2Allowed3Seen) { INSTANTIATE_TEST_SUITE_P(Protocols, CdnLoopFilterIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, // Upstream doesn't matter, so by testing only 1, // the test is twice as fast. - {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); } // namespace diff --git a/test/extensions/filters/http/common/compressor/compressor_integration_tests.cc b/test/extensions/filters/http/common/compressor/compressor_integration_tests.cc index 1ee14acf3cd4e..fc351d6994e56 100644 --- a/test/extensions/filters/http/common/compressor/compressor_integration_tests.cc +++ b/test/extensions/filters/http/common/compressor/compressor_integration_tests.cc @@ -129,7 +129,7 @@ ConfigHelper::HttpModifierFunction setRouteUsingWebsocket() { } void WebsocketWithCompressorIntegrationTest::initialize() { - if (upstreamProtocol() != FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() != Http::CodecType::HTTP1) { config_helper_.addConfigModifier( [&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void { ConfigHelper::HttpProtocolOptions protocol_options; @@ -140,7 +140,7 @@ void WebsocketWithCompressorIntegrationTest::initialize() { *bootstrap.mutable_static_resources()->mutable_clusters(0), protocol_options); }); } - if (downstreamProtocol() != Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() != Http::CodecType::HTTP1) { config_helper_.addConfigModifier( [&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& hcm) -> void { hcm.mutable_http2_protocol_options()->set_allow_connect(true); }); @@ -205,7 +205,7 @@ TEST_P(WebsocketWithCompressorIntegrationTest, NonWebsocketUpgrade) { performUpgrade(upgradeRequestHeaders("foo", 0), upgradeResponseHeaders("foo")); sendBidirectionalData(); codec_client_->sendData(*request_encoder_, "bye!", false); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { codec_client_->close(); } else { codec_client_->sendReset(*request_encoder_); @@ -268,7 +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() == FakeHttpConnection::Type::HTTP1) { + 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(), diff --git a/test/extensions/filters/http/common/compressor/compressor_integration_tests.h b/test/extensions/filters/http/common/compressor/compressor_integration_tests.h index 43bd52e50d740..38d82c04dc589 100644 --- a/test/extensions/filters/http/common/compressor/compressor_integration_tests.h +++ b/test/extensions/filters/http/common/compressor/compressor_integration_tests.h @@ -28,7 +28,7 @@ class WebsocketWithCompressorIntegrationTest : public HttpProtocolIntegrationTes ABSL_MUST_USE_RESULT testing::AssertionResult waitForUpstreamDisconnectOrReset() { - if (upstreamProtocol() != FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() != Http::CodecType::HTTP1) { return upstream_request_->waitForReset(); } else { return fake_upstream_connection_->waitForDisconnect(); diff --git a/test/extensions/filters/http/composite/composite_filter_integration_test.cc b/test/extensions/filters/http/composite/composite_filter_integration_test.cc index de0abba85a078..b639e8cf3a7b5 100644 --- a/test/extensions/filters/http/composite/composite_filter_integration_test.cc +++ b/test/extensions/filters/http/composite/composite_filter_integration_test.cc @@ -11,8 +11,7 @@ namespace Envoy { class CompositeFilterIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - CompositeFilterIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + CompositeFilterIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void initialize() override { config_helper_.addRuntimeOverride("envoy.reloadable_features.experimental_matching_api", diff --git a/test/extensions/filters/http/compressor/compressor_filter_integration_test.cc b/test/extensions/filters/http/compressor/compressor_filter_integration_test.cc index aaaf2908facf9..a95e6accf74f4 100644 --- a/test/extensions/filters/http/compressor/compressor_filter_integration_test.cc +++ b/test/extensions/filters/http/compressor/compressor_filter_integration_test.cc @@ -14,7 +14,7 @@ class CompressorIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - CorsFilterIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + CorsFilterIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void initialize() override { config_helper_.addFilter("name: envoy.filters.http.cors"); diff --git a/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc b/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc index 4f9b4f8a011df..be1cb8384aa95 100644 --- a/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc +++ b/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc @@ -14,7 +14,7 @@ namespace Envoy { class DecompressorIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - DecompressorIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) { + DecompressorIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) { Extensions::Compression::Gzip::Compressor::GzipCompressorLibraryFactory compressor_library_factory; envoy::extensions::compression::gzip::compressor::v3::Gzip factory_config; @@ -29,7 +29,7 @@ class DecompressorIntegrationTest : public testing::TestWithParam>; class ExtAuthzGrpcIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, public HttpIntegrationTest { public: - ExtAuthzGrpcIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + ExtAuthzGrpcIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void initializeConfig(bool disable_with_metadata = false) { @@ -317,9 +316,9 @@ class ExtAuthzGrpcIntegrationTest : public Grpc::VersionedGrpcClientIntegrationP cleanupUpstreamAndDownstream(); } - const std::string expectedCheckRequest(Http::CodecClient::Type downstream_protocol) { + const std::string expectedCheckRequest(Http::CodecType downstream_protocol) { const std::string expected_downstream_protocol = - downstream_protocol == Http::CodecClient::Type::HTTP1 ? "HTTP/1.1" : "HTTP/2"; + downstream_protocol == Http::CodecType::HTTP1 ? "HTTP/1.1" : "HTTP/2"; constexpr absl::string_view expected_format = R"EOF( attributes: request: @@ -336,17 +335,15 @@ class ExtAuthzGrpcIntegrationTest : public Grpc::VersionedGrpcClientIntegrationP expected_downstream_protocol); } - void expectCheckRequestWithBody(Http::CodecClient::Type downstream_protocol, - uint64_t request_size) { + void expectCheckRequestWithBody(Http::CodecType downstream_protocol, uint64_t request_size) { expectCheckRequestWithBodyWithHeaders(downstream_protocol, request_size, Headers{}, Headers{}, Headers{}, Http::TestRequestHeaderMapImpl{}, Http::TestRequestHeaderMapImpl{}); } void expectCheckRequestWithBodyWithHeaders( - Http::CodecClient::Type downstream_protocol, uint64_t request_size, - const Headers& headers_to_add, const Headers& headers_to_append, - const Headers& headers_to_remove, + Http::CodecType downstream_protocol, uint64_t request_size, const Headers& headers_to_add, + const Headers& headers_to_append, const Headers& headers_to_remove, const Http::TestRequestHeaderMapImpl& new_headers_from_upstream, const Http::TestRequestHeaderMapImpl& headers_to_append_multiple) { initializeConfig(); @@ -379,7 +376,7 @@ class ExtAuthzGrpcIntegrationTest : public Grpc::VersionedGrpcClientIntegrationP const std::string& expected_status) { initializeConfig(disable_with_metadata); setDenyAtDisableRuntimeConfig(deny_at_disable, disable_with_metadata); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); initiateClientConnection(4); if (!deny_at_disable) { @@ -406,11 +403,11 @@ class ExtAuthzGrpcIntegrationTest : public Grpc::VersionedGrpcClientIntegrationP class ExtAuthzHttpIntegrationTest : public HttpIntegrationTest, public TestWithParam { public: - ExtAuthzHttpIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + ExtAuthzHttpIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); } // By default, HTTP Service uses case sensitive string matcher. @@ -580,28 +577,28 @@ INSTANTIATE_TEST_SUITE_P(IpVersionsCientType, ExtAuthzGrpcIntegrationTest, // HTTP/1.1. TEST_P(ExtAuthzGrpcIntegrationTest, HTTP1DownstreamRequestWithBody) { XDS_DEPRECATED_FEATURE_TEST_SKIP; - expectCheckRequestWithBody(Http::CodecClient::Type::HTTP1, 4); + expectCheckRequestWithBody(Http::CodecType::HTTP1, 4); } // Verifies that the request body is included in the CheckRequest when the downstream protocol is // HTTP/1.1 and the size of the request body is larger than max_request_bytes. TEST_P(ExtAuthzGrpcIntegrationTest, HTTP1DownstreamRequestWithLargeBody) { XDS_DEPRECATED_FEATURE_TEST_SKIP; - expectCheckRequestWithBody(Http::CodecClient::Type::HTTP1, 2048); + expectCheckRequestWithBody(Http::CodecType::HTTP1, 2048); } // Verifies that the request body is included in the CheckRequest when the downstream protocol is // HTTP/2. TEST_P(ExtAuthzGrpcIntegrationTest, HTTP2DownstreamRequestWithBody) { XDS_DEPRECATED_FEATURE_TEST_SKIP; - expectCheckRequestWithBody(Http::CodecClient::Type::HTTP2, 4); + expectCheckRequestWithBody(Http::CodecType::HTTP2, 4); } // Verifies that the request body is included in the CheckRequest when the downstream protocol is // HTTP/2 and the size of the request body is larger than max_request_bytes. TEST_P(ExtAuthzGrpcIntegrationTest, HTTP2DownstreamRequestWithLargeBody) { XDS_DEPRECATED_FEATURE_TEST_SKIP; - expectCheckRequestWithBody(Http::CodecClient::Type::HTTP2, 2048); + expectCheckRequestWithBody(Http::CodecType::HTTP2, 2048); } // Verifies that the original request headers will be added and appended when the authorization @@ -610,7 +607,7 @@ TEST_P(ExtAuthzGrpcIntegrationTest, HTTP2DownstreamRequestWithLargeBody) { TEST_P(ExtAuthzGrpcIntegrationTest, SendHeadersToAddAndToAppendToUpstream) { XDS_DEPRECATED_FEATURE_TEST_SKIP; expectCheckRequestWithBodyWithHeaders( - Http::CodecClient::Type::HTTP1, 4, + Http::CodecType::HTTP1, 4, /*headers_to_add=*/Headers{{"header1", "header1"}}, /*headers_to_append=*/Headers{{"header2", "header2"}}, /*headers_to_remove=*/Headers{{"remove-me", "upstream-should-not-see-me"}}, @@ -646,14 +643,14 @@ TEST_P(ExtAuthzGrpcIntegrationTest, DownstreamHeadersOnSuccess) { initializeConfig(); // Use h1, set up the test. - setDownstreamProtocol(Http::CodecClient::Type::HTTP1); + setDownstreamProtocol(Http::CodecType::HTTP1); HttpIntegrationTest::initialize(); // Start a client connection and request. initiateClientConnection(0); // Wait for the ext_authz request as a result of the client request. - waitForExtAuthzRequest(expectedCheckRequest(Http::CodecClient::Type::HTTP1)); + waitForExtAuthzRequest(expectedCheckRequest(Http::CodecType::HTTP1)); // Send back an ext_authz response with response_headers_to_add set. sendExtAuthzResponse(Headers{}, Headers{}, Headers{}, Http::TestRequestHeaderMapImpl{}, @@ -686,12 +683,11 @@ TEST_P(ExtAuthzHttpIntegrationTest, DefaultCaseSensitiveStringMatcher) { class ExtAuthzLocalReplyIntegrationTest : public HttpIntegrationTest, public TestWithParam { public: - ExtAuthzLocalReplyIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + ExtAuthzLocalReplyIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); } void cleanup() { @@ -798,7 +794,7 @@ TEST_P(ExtAuthzLocalReplyIntegrationTest, DeniedHeaderTest) { TEST_P(ExtAuthzGrpcIntegrationTest, GoogleAsyncClientCreation) { XDS_DEPRECATED_FEATURE_TEST_SKIP; initializeConfig(); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); int expected_grpc_client_creation_count = 0; @@ -811,7 +807,7 @@ TEST_P(ExtAuthzGrpcIntegrationTest, GoogleAsyncClientCreation) { } initiateClientConnection(4, Headers{}, Headers{}); - waitForExtAuthzRequest(expectedCheckRequest(Http::CodecClient::Type::HTTP2)); + waitForExtAuthzRequest(expectedCheckRequest(Http::CodecType::HTTP2)); sendExtAuthzResponse(Headers{}, Headers{}, Headers{}, Http::TestRequestHeaderMapImpl{}, Http::TestRequestHeaderMapImpl{}, Headers{}); diff --git a/test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc b/test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc index 0e3786158db12..0b9150a3ecaa0 100644 --- a/test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc +++ b/test/extensions/filters/http/ext_proc/ext_proc_integration_test.cc @@ -41,12 +41,12 @@ using namespace std::chrono_literals; class ExtProcIntegrationTest : public HttpIntegrationTest, public Grpc::GrpcClientIntegrationParamTest { protected: - ExtProcIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion()) {} + ExtProcIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion()) {} void createUpstreams() override { // Need to create a separate "upstream" for the gRPC server HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void TearDown() override { @@ -82,8 +82,8 @@ class ExtProcIntegrationTest : public HttpIntegrationTest, ext_proc_filter.mutable_typed_config()->PackFrom(proto_config_); config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); }); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); } IntegrationStreamDecoderPtr sendDownstreamRequest( diff --git a/test/extensions/filters/http/fault/fault_filter_integration_test.cc b/test/extensions/filters/http/fault/fault_filter_integration_test.cc index f23633aa308a9..370c662438bee 100644 --- a/test/extensions/filters/http/fault/fault_filter_integration_test.cc +++ b/test/extensions/filters/http/fault/fault_filter_integration_test.cc @@ -393,7 +393,7 @@ TEST_P(FaultIntegrationTestAllProtocols, FaultAbortGrpcConfig) { class FaultIntegrationTestHttp2 : public FaultIntegrationTest {}; INSTANTIATE_TEST_SUITE_P(Protocols, FaultIntegrationTestHttp2, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP2})), + {Http::CodecType::HTTP2}, {Http::CodecType::HTTP2})), HttpProtocolIntegrationTest::protocolTestParamsToString); // Rate limiting with trailers received after the body has been flushed. diff --git a/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_integration_test.cc b/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_integration_test.cc index 911e52eb127d1..43cb6339eef46 100644 --- a/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_integration_test.cc +++ b/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_integration_test.cc @@ -26,11 +26,10 @@ namespace { class ReverseBridgeIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - ReverseBridgeIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) {} + ReverseBridgeIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) {} void initialize() override { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); const std::string filter = R"EOF( @@ -57,7 +56,7 @@ name: grpc_http1_reverse_bridge void TearDown() override { fake_upstream_connection_.reset(); } protected: - FakeHttpConnection::Type upstream_protocol_; + Http::CodecType upstream_protocol_; }; INSTANTIATE_TEST_SUITE_P(IpVersions, ReverseBridgeIntegrationTest, @@ -68,7 +67,7 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, ReverseBridgeIntegrationTest, // doesn't enable the bridge. // Regression test of https://github.com/envoyproxy/envoy/issues/9922 TEST_P(ReverseBridgeIntegrationTest, DisabledRoute) { - upstream_protocol_ = FakeHttpConnection::Type::HTTP2; + upstream_protocol_ = Http::CodecType::HTTP2; initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -117,7 +116,7 @@ TEST_P(ReverseBridgeIntegrationTest, DisabledRoute) { } TEST_P(ReverseBridgeIntegrationTest, EnabledRoute) { - upstream_protocol_ = FakeHttpConnection::Type::HTTP1; + upstream_protocol_ = Http::CodecType::HTTP1; initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -174,7 +173,7 @@ TEST_P(ReverseBridgeIntegrationTest, EnabledRoute) { } TEST_P(ReverseBridgeIntegrationTest, EnabledRouteBadContentType) { - upstream_protocol_ = FakeHttpConnection::Type::HTTP1; + upstream_protocol_ = Http::CodecType::HTTP1; initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); diff --git a/test/extensions/filters/http/grpc_json_transcoder/grpc_json_transcoder_integration_test.cc b/test/extensions/filters/http/grpc_json_transcoder/grpc_json_transcoder_integration_test.cc index 15e669eb33671..065d599f1fdd8 100644 --- a/test/extensions/filters/http/grpc_json_transcoder/grpc_json_transcoder_integration_test.cc +++ b/test/extensions/filters/http/grpc_json_transcoder/grpc_json_transcoder_integration_test.cc @@ -30,11 +30,10 @@ class GrpcJsonTranscoderIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - GrpcJsonTranscoderIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + GrpcJsonTranscoderIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void SetUp() override { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); const std::string filter = R"EOF( name: grpc_json_transcoder @@ -1253,7 +1252,7 @@ class OverrideConfigGrpcJsonTranscoderIntegrationTest : public GrpcJsonTranscode * Global initializer for all integration tests. */ void SetUp() override { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); // creates filter but doesn't apply it to bookstore services const std::string filter = R"EOF( @@ -1301,7 +1300,7 @@ class BufferLimitsDisabledGrpcJsonTranscoderIntegrationTest : public GrpcJsonTranscoderIntegrationTest { public: void SetUp() override { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); const std::string filter = R"EOF( name: grpc_json_transcoder diff --git a/test/extensions/filters/http/grpc_web/grpc_web_filter_integration_test.cc b/test/extensions/filters/http/grpc_web/grpc_web_filter_integration_test.cc index 32ca9673445af..701f97662a9e5 100644 --- a/test/extensions/filters/http/grpc_web/grpc_web_filter_integration_test.cc +++ b/test/extensions/filters/http/grpc_web/grpc_web_filter_integration_test.cc @@ -18,7 +18,7 @@ constexpr uint64_t MAX_BUFFERED_PLAINTEXT_LENGTH = 16384; using SkipEncodingEmptyTrailers = bool; using ContentType = std::string; using Accept = std::string; -using TestParams = std::tuple; class GrpcWebFilterIntegrationTest : public testing::TestWithParam, @@ -28,18 +28,18 @@ class GrpcWebFilterIntegrationTest : public testing::TestWithParam, : HttpIntegrationTest(std::get<1>(GetParam()), std::get<0>(GetParam())) {} void SetUp() override { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); config_helper_.addFilter("name: envoy.filters.http.grpc_web"); } void initialize() override { - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { config_helper_.addConfigModifier(setEnableDownstreamTrailersHttp1()); } else { skipEncodingEmptyTrailers(http2_skip_encoding_empty_trailers_); } - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); } @@ -139,13 +139,13 @@ class GrpcWebFilterIntegrationTest : public testing::TestWithParam, "{}_{}_{}_{}_{}", TestUtility::ipTestParamsToString(testing::TestParamInfo( std::get<0>(params.param), params.index)), - std::get<1>(params.param) == Http::CodecClient::Type::HTTP2 ? "Http2" : "Http", + std::get<1>(params.param) == Http::CodecType::HTTP2 ? "Http2" : "Http", std::get<2>(params.param) ? "SkipEncodingEmptyTrailers" : "SubmitEncodingEmptyTrailers", std::get<3>(params.param) == text ? "SendText" : "SendBinary", std::get<4>(params.param) == text ? "AcceptText" : "AcceptBinary"); } - const Envoy::Http::CodecClient::Type downstream_protocol_{std::get<1>(GetParam())}; + const Envoy::Http::CodecType downstream_protocol_{std::get<1>(GetParam())}; const bool http2_skip_encoding_empty_trailers_{std::get<2>(GetParam())}; const ContentType content_type_{std::get<3>(GetParam())}; const Accept accept_{std::get<4>(GetParam())}; @@ -153,12 +153,12 @@ class GrpcWebFilterIntegrationTest : public testing::TestWithParam, INSTANTIATE_TEST_SUITE_P( Params, GrpcWebFilterIntegrationTest, - testing::Combine( - testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), - testing::Values(Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2), - testing::Values(SkipEncodingEmptyTrailers{true}, SkipEncodingEmptyTrailers{false}), - testing::Values(ContentType{text}, ContentType{binary}), - testing::Values(Accept{text}, Accept{binary})), + testing::Combine(testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), + testing::Values(Http::CodecType::HTTP1, Http::CodecType::HTTP2), + testing::Values(SkipEncodingEmptyTrailers{true}, + SkipEncodingEmptyTrailers{false}), + testing::Values(ContentType{text}, ContentType{binary}), + testing::Values(Accept{text}, Accept{binary})), GrpcWebFilterIntegrationTest::testParamsToString); TEST_P(GrpcWebFilterIntegrationTest, GrpcWebTrailersNotDuplicated) { @@ -202,12 +202,12 @@ TEST_P(GrpcWebFilterIntegrationTest, GrpcWebTrailersNotDuplicated) { EXPECT_TRUE(absl::StrContains(response_body, "response1:trailer1")); EXPECT_TRUE(absl::StrContains(response_body, "response2:trailer2")); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { // When the downstream protocol is HTTP/1.1 we expect the trailers to be in the response-body. EXPECT_EQ(nullptr, response->trailers()); } - if (downstream_protocol_ == Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ == Http::CodecType::HTTP2) { if (http2_skip_encoding_empty_trailers_) { // When the downstream protocol is HTTP/2 and the feature-flag to skip encoding empty trailers // is turned on, expect that the trailers are included in the response-body. diff --git a/test/extensions/filters/http/gzip/gzip_filter_integration_test.cc b/test/extensions/filters/http/gzip/gzip_filter_integration_test.cc index bd0edc6d1d560..e17b55409ec89 100644 --- a/test/extensions/filters/http/gzip/gzip_filter_integration_test.cc +++ b/test/extensions/filters/http/gzip/gzip_filter_integration_test.cc @@ -14,7 +14,7 @@ class GzipIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - LuaIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + LuaIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP1); - addFakeUpstream(FakeHttpConnection::Type::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); // Create the xDS upstream. - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void initializeFilter(const std::string& filter_config, const std::string& domain = "*") { diff --git a/test/extensions/filters/http/oauth2/oauth_integration_test.cc b/test/extensions/filters/http/oauth2/oauth_integration_test.cc index e12091ef503ef..fe2cc0649334a 100644 --- a/test/extensions/filters/http/oauth2/oauth_integration_test.cc +++ b/test/extensions/filters/http/oauth2/oauth_integration_test.cc @@ -20,7 +20,7 @@ namespace { class OauthIntegrationTest : public testing::Test, public HttpIntegrationTest { public: OauthIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, Network::Address::IpVersion::v4) { + : HttpIntegrationTest(Http::CodecType::HTTP2, Network::Address::IpVersion::v4) { enableHalfClose(true); } @@ -38,7 +38,7 @@ class OauthIntegrationTest : public testing::Test, public HttpIntegrationTest { } void initialize() override { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); TestEnvironment::writeStringToFileForTest("token_secret.yaml", R"EOF( resources: diff --git a/test/extensions/filters/http/ratelimit/ratelimit_integration_test.cc b/test/extensions/filters/http/ratelimit/ratelimit_integration_test.cc index fbcaf61a12222..aab0ff2a93e32 100644 --- a/test/extensions/filters/http/ratelimit/ratelimit_integration_test.cc +++ b/test/extensions/filters/http/ratelimit/ratelimit_integration_test.cc @@ -25,7 +25,7 @@ namespace { class RatelimitIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, public HttpIntegrationTest { public: - RatelimitIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + RatelimitIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} void SetUp() override { XDS_DEPRECATED_FEATURE_TEST_SKIP; @@ -34,7 +34,7 @@ class RatelimitIntegrationTest : public Grpc::VersionedGrpcClientIntegrationPara void createUpstreams() override { HttpIntegrationTest::createUpstreams(); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void initialize() override { diff --git a/test/extensions/filters/http/router/auto_sni_integration_test.cc b/test/extensions/filters/http/router/auto_sni_integration_test.cc index 4c16326c2e518..6515e1aff0007 100644 --- a/test/extensions/filters/http/router/auto_sni_integration_test.cc +++ b/test/extensions/filters/http/router/auto_sni_integration_test.cc @@ -16,10 +16,10 @@ class AutoSniIntegrationTest : public testing::TestWithParammutable_clusters()->at(0); @@ -41,7 +41,7 @@ class AutoSniIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - SquashFilterIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + SquashFilterIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} ~SquashFilterIntegrationTest() override { if (fake_squash_connection_) { @@ -71,7 +71,7 @@ class SquashFilterIntegrationTest : public testing::TestWithParam(GetParam())) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, std::get<0>(GetParam())) {} void initialize() override; void TearDown() override; diff --git a/test/extensions/transport_sockets/tls/integration/ssl_integration_test.cc b/test/extensions/transport_sockets/tls/integration/ssl_integration_test.cc index 25ca940ceec49..ff3a3212ef033 100644 --- a/test/extensions/transport_sockets/tls/integration/ssl_integration_test.cc +++ b/test/extensions/transport_sockets/tls/integration/ssl_integration_test.cc @@ -139,7 +139,7 @@ TEST_P(SslIntegrationTest, RouterRequestAndResponseWithBodyNoBuffer) { } TEST_P(SslIntegrationTest, RouterRequestAndResponseWithBodyNoBufferHttp2) { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); config_helper_.setClientCodec(envoy::extensions::filters::network::http_connection_manager::v3:: HttpConnectionManager::AUTO); ConnectionCreationFunction creator = [&]() -> Network::ClientConnectionPtr { @@ -158,7 +158,7 @@ TEST_P(SslIntegrationTest, RouterRequestAndResponseWithBodyNoBufferVerifySAN) { } TEST_P(SslIntegrationTest, RouterRequestAndResponseWithBodyNoBufferHttp2VerifySAN) { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); ConnectionCreationFunction creator = [&]() -> Network::ClientConnectionPtr { return makeSslClientConnection(ClientSslTransportOptions().setAlpn(true).setSan(san_to_match_)); }; @@ -194,7 +194,7 @@ TEST_P(SslIntegrationTest, RouterDownstreamDisconnectBeforeResponseComplete) { #if defined(__APPLE__) || defined(WIN32) // Skip this test on OS X + Windows: we can't detect the early close on non-Linux, and we // won't clean up the upstream connection until it times out. See #4294. - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { return; } #endif diff --git a/test/extensions/transport_sockets/tls/integration/ssl_integration_test.h b/test/extensions/transport_sockets/tls/integration/ssl_integration_test.h index e7f615c54476c..930cc38697f87 100644 --- a/test/extensions/transport_sockets/tls/integration/ssl_integration_test.h +++ b/test/extensions/transport_sockets/tls/integration/ssl_integration_test.h @@ -17,7 +17,7 @@ namespace Ssl { class SslIntegrationTestBase : public HttpIntegrationTest { public: SslIntegrationTestBase(Network::Address::IpVersion ip_version) - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ip_version) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, ip_version) {} void initialize() override; diff --git a/test/integration/README.md b/test/integration/README.md index d16031807a9e4..6e13c958aa2c1 100644 --- a/test/integration/README.md +++ b/test/integration/README.md @@ -50,7 +50,7 @@ The [`ConfigHelper`](../config/utility.h) has utilities for common alterations s ```c++ // Set the default protocol to HTTP2 -setDownstreamProtocol(Http::CodecClient::Type::HTTP2); +setDownstreamProtocol(Http::CodecType::HTTP2); ``` or diff --git a/test/integration/ads_integration.cc b/test/integration/ads_integration.cc index cf0fbeb710467..5d19303690533 100644 --- a/test/integration/ads_integration.cc +++ b/test/integration/ads_integration.cc @@ -22,7 +22,7 @@ namespace Envoy { AdsIntegrationTest::AdsIntegrationTest(envoy::config::core::v3::ApiVersion resource_api_version, envoy::config::core::v3::ApiVersion transport_api_version) - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), + : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), ConfigHelper::adsBootstrap( sotwOrDelta() == Grpc::SotwOrDelta::Sotw ? "GRPC" : "DELTA_GRPC", resource_api_version, transport_api_version)) { @@ -31,7 +31,7 @@ AdsIntegrationTest::AdsIntegrationTest(envoy::config::core::v3::ApiVersion resou tls_xds_upstream_ = true; sotw_or_delta_ = sotwOrDelta(); api_version_ = resource_api_version; - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); } void AdsIntegrationTest::TearDown() { cleanUpXdsConnection(); } diff --git a/test/integration/ads_integration_test.cc b/test/integration/ads_integration_test.cc index 08e6d8661a9b8..739b6d9f896b6 100644 --- a/test/integration/ads_integration_test.cc +++ b/test/integration/ads_integration_test.cc @@ -89,7 +89,7 @@ TEST_P(AdsIntegrationTest, TestPrimaryClusterWarmClusterInitialization) { const auto cds_type_url = Config::getTypeUrl( envoy::config::core::v3::ApiVersion::V3); auto loopback = Network::Test::getLoopbackAddressString(ipVersion()); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); auto port = fake_upstreams_.back()->localAddress()->ip()->port(); // This cluster will be blocked since endpoint name cannot be resolved. @@ -1055,7 +1055,7 @@ class AdsFailIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public HttpIntegrationTest { public: AdsFailIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), + : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), ConfigHelper::adsBootstrap( sotwOrDelta() == Grpc::SotwOrDelta::Sotw ? "GRPC" : "DELTA_GRPC", envoy::config::core::v3::ApiVersion::V3)) { @@ -1075,7 +1075,7 @@ class AdsFailIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, ads_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); ads_cluster->set_name("ads_cluster"); }); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); } }; @@ -1096,7 +1096,7 @@ class AdsConfigIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public HttpIntegrationTest { public: AdsConfigIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), + : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), ConfigHelper::adsBootstrap( sotwOrDelta() == Grpc::SotwOrDelta::Sotw ? "GRPC" : "DELTA_GRPC", envoy::config::core::v3::ApiVersion::V3)) { @@ -1125,7 +1125,7 @@ class AdsConfigIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, eds_config->set_resource_api_version(envoy::config::core::v3::ApiVersion::V3); eds_config->mutable_ads(); }); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); } }; @@ -1282,7 +1282,7 @@ class AdsClusterFromFileIntegrationTest : public Grpc::DeltaSotwIntegrationParam public HttpIntegrationTest { public: AdsClusterFromFileIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), + : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), ConfigHelper::adsBootstrap( sotwOrDelta() == Grpc::SotwOrDelta::Sotw ? "GRPC" : "DELTA_GRPC", envoy::config::core::v3::ApiVersion::V3)) { @@ -1323,7 +1323,7 @@ class AdsClusterFromFileIntegrationTest : public Grpc::DeltaSotwIntegrationParam eds_config->set_resource_api_version(envoy::config::core::v3::ApiVersion::V3); eds_config->mutable_ads(); }); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); } diff --git a/test/integration/alpn_integration_test.cc b/test/integration/alpn_integration_test.cc index 264036a4bc2a8..fa1e33fcee360 100644 --- a/test/integration/alpn_integration_test.cc +++ b/test/integration/alpn_integration_test.cc @@ -9,12 +9,12 @@ namespace { class AlpnIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - AlpnIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) {} + AlpnIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) {} void SetUp() override { autonomous_upstream_ = true; setUpstreamCount(2); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); upstream_tls_ = true; config_helper_.configureUpstreamTls(true); @@ -40,7 +40,7 @@ class AlpnIntegrationTest : public testing::TestWithParam protocols_; + std::vector protocols_; }; INSTANTIATE_TEST_SUITE_P(IpVersions, AlpnIntegrationTest, @@ -48,8 +48,8 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, AlpnIntegrationTest, TestUtility::ipTestParamsToString); TEST_P(AlpnIntegrationTest, Http2) { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); - protocols_ = {FakeHttpConnection::Type::HTTP2, FakeHttpConnection::Type::HTTP2}; + setUpstreamProtocol(Http::CodecType::HTTP2); + protocols_ = {Http::CodecType::HTTP2, Http::CodecType::HTTP2}; initialize(); codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http")))); @@ -60,8 +60,8 @@ TEST_P(AlpnIntegrationTest, Http2) { } TEST_P(AlpnIntegrationTest, Http1) { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP1); - protocols_ = {FakeHttpConnection::Type::HTTP1, FakeHttpConnection::Type::HTTP1}; + setUpstreamProtocol(Http::CodecType::HTTP1); + protocols_ = {Http::CodecType::HTTP1, Http::CodecType::HTTP1}; initialize(); codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http")))); @@ -72,7 +72,7 @@ TEST_P(AlpnIntegrationTest, Http1) { } TEST_P(AlpnIntegrationTest, Mixed) { - protocols_ = {FakeHttpConnection::Type::HTTP1, FakeHttpConnection::Type::HTTP2}; + protocols_ = {Http::CodecType::HTTP1, Http::CodecType::HTTP2}; initialize(); codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http")))); diff --git a/test/integration/alpn_selection_integration_test.cc b/test/integration/alpn_selection_integration_test.cc index b28c42fbffc03..052bc5e14f752 100644 --- a/test/integration/alpn_selection_integration_test.cc +++ b/test/integration/alpn_selection_integration_test.cc @@ -18,14 +18,12 @@ namespace Envoy { class AlpnSelectionIntegrationTest : public testing::Test, public HttpIntegrationTest { public: AlpnSelectionIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, - TestEnvironment::getIpVersionsForTest().front(), + : HttpIntegrationTest(Http::CodecType::HTTP1, TestEnvironment::getIpVersionsForTest().front(), ConfigHelper::httpProxyConfig()) {} void initialize() override { - setDownstreamProtocol(Http::CodecClient::Type::HTTP1); - setUpstreamProtocol(use_h2_ ? FakeHttpConnection::Type::HTTP2 - : FakeHttpConnection::Type::HTTP1); + setDownstreamProtocol(Http::CodecType::HTTP1); + setUpstreamProtocol(use_h2_ ? Http::CodecType::HTTP2 : Http::CodecType::HTTP1); config_helper_.addConfigModifier([&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { auto* static_resources = bootstrap.mutable_static_resources(); auto* cluster = static_resources->mutable_clusters(0); @@ -81,8 +79,7 @@ require_client_certificate: true void createUpstreams() override { auto endpoint = upstream_address_fn_(0); FakeUpstreamConfig config = upstreamConfig(); - config.upstream_protocol_ = - use_h2_ ? FakeHttpConnection::Type::HTTP2 : FakeHttpConnection::Type::HTTP1; + config.upstream_protocol_ = use_h2_ ? Http::CodecType::HTTP2 : Http::CodecType::HTTP1; fake_upstreams_.emplace_back( new FakeUpstream(createUpstreamSslContext(), endpoint->ip()->port(), version_, config)); } diff --git a/test/integration/autonomous_upstream.cc b/test/integration/autonomous_upstream.cc index 762da275b31d1..65d16dd25fd7d 100644 --- a/test/integration/autonomous_upstream.cc +++ b/test/integration/autonomous_upstream.cc @@ -94,7 +94,8 @@ void AutonomousStream::sendResponse() { AutonomousHttpConnection::AutonomousHttpConnection(AutonomousUpstream& autonomous_upstream, SharedConnectionWrapper& shared_connection, - Type type, AutonomousUpstream& upstream) + Http::CodecType type, + AutonomousUpstream& upstream) : FakeHttpConnection(autonomous_upstream, shared_connection, type, upstream.timeSystem(), Http::DEFAULT_MAX_REQUEST_HEADERS_KB, Http::DEFAULT_MAX_HEADERS_COUNT, envoy::config::core::v3::HttpProtocolOptions::ALLOW), diff --git a/test/integration/autonomous_upstream.h b/test/integration/autonomous_upstream.h index d5ae283fec568..aa0e15fb1baa1 100644 --- a/test/integration/autonomous_upstream.h +++ b/test/integration/autonomous_upstream.h @@ -45,7 +45,7 @@ class AutonomousStream : public FakeStream { class AutonomousHttpConnection : public FakeHttpConnection { public: AutonomousHttpConnection(AutonomousUpstream& autonomous_upstream, - SharedConnectionWrapper& shared_connection, Type type, + SharedConnectionWrapper& shared_connection, Http::CodecType type, AutonomousUpstream& upstream); Http::RequestDecoder& newStream(Http::ResponseEncoder& response_encoder, bool) override; diff --git a/test/integration/base_integration_test.cc b/test/integration/base_integration_test.cc index ac4cf88eb7030..012197a98f1fd 100644 --- a/test/integration/base_integration_test.cc +++ b/test/integration/base_integration_test.cc @@ -121,12 +121,12 @@ BaseIntegrationTest::createUpstreamTlsContext(const FakeUpstreamConfig& upstream TestEnvironment::runfilesPath("test/config/integration/certs/upstreamkey.pem"), TestEnvironment::runfilesPath("test/config/integration/certs/cacert.pem")); TestUtility::loadFromYaml(yaml, tls_context); - if (upstream_config.upstream_protocol_ == FakeHttpConnection::Type::HTTP2) { + if (upstream_config.upstream_protocol_ == Http::CodecType::HTTP2) { tls_context.mutable_common_tls_context()->add_alpn_protocols("h2"); - } else if (upstream_config.upstream_protocol_ == FakeHttpConnection::Type::HTTP1) { + } else if (upstream_config.upstream_protocol_ == Http::CodecType::HTTP1) { tls_context.mutable_common_tls_context()->add_alpn_protocols("http/1.1"); } - if (upstream_config.upstream_protocol_ != FakeHttpConnection::Type::HTTP3) { + if (upstream_config.upstream_protocol_ != Http::CodecType::HTTP3) { auto cfg = std::make_unique( tls_context, factory_context_); static Stats::Scope* upstream_stats_store = new Stats::IsolatedStoreImpl(); @@ -217,9 +217,9 @@ void BaseIntegrationTest::createEnvoy() { createGeneratedApiTestServer(bootstrap_path, named_ports, {false, true, false}, false); } -void BaseIntegrationTest::setUpstreamProtocol(FakeHttpConnection::Type protocol) { +void BaseIntegrationTest::setUpstreamProtocol(Http::CodecType protocol) { upstream_config_.upstream_protocol_ = protocol; - if (upstream_config_.upstream_protocol_ == FakeHttpConnection::Type::HTTP2) { + if (upstream_config_.upstream_protocol_ == Http::CodecType::HTTP2) { config_helper_.addConfigModifier( [&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void { RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() >= 1, ""); @@ -228,7 +228,7 @@ void BaseIntegrationTest::setUpstreamProtocol(FakeHttpConnection::Type protocol) ConfigHelper::setProtocolOptions( *bootstrap.mutable_static_resources()->mutable_clusters(0), protocol_options); }); - } else if (upstream_config_.upstream_protocol_ == FakeHttpConnection::Type::HTTP1) { + } else if (upstream_config_.upstream_protocol_ == Http::CodecType::HTTP1) { config_helper_.addConfigModifier( [&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void { RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() >= 1, ""); @@ -238,7 +238,7 @@ void BaseIntegrationTest::setUpstreamProtocol(FakeHttpConnection::Type protocol) *bootstrap.mutable_static_resources()->mutable_clusters(0), protocol_options); }); } else { - RELEASE_ASSERT(protocol == FakeHttpConnection::Type::HTTP3, ""); + RELEASE_ASSERT(protocol == Http::CodecType::HTTP3, ""); setUdpFakeUpstream(FakeUpstreamConfig::UdpConfig()); upstream_tls_ = true; config_helper_.configureUpstreamTls(false, true); @@ -445,7 +445,7 @@ void BaseIntegrationTest::createXdsUpstream() { return; } if (tls_xds_upstream_ == false) { - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } else { envoy::extensions::transport_sockets::tls::v3::DownstreamTlsContext tls_context; auto* common_tls_context = tls_context.mutable_common_tls_context(); @@ -461,7 +461,7 @@ void BaseIntegrationTest::createXdsUpstream() { upstream_stats_store_ = std::make_unique(); auto context = std::make_unique( std::move(cfg), context_manager_, *upstream_stats_store_, std::vector{}); - addFakeUpstream(std::move(context), FakeHttpConnection::Type::HTTP2); + addFakeUpstream(std::move(context), Http::CodecType::HTTP2); } xds_upstream_ = fake_upstreams_.back().get(); } diff --git a/test/integration/base_integration_test.h b/test/integration/base_integration_test.h index 9f902f958d2dc..37230364cd60a 100644 --- a/test/integration/base_integration_test.h +++ b/test/integration/base_integration_test.h @@ -64,7 +64,7 @@ class BaseIntegrationTest : protected Logger::Loggable { // Finalize the config and spin up an Envoy instance. virtual void createEnvoy(); // Sets upstream_protocol_ and alters the upstream protocol in the config_helper_ - void setUpstreamProtocol(FakeHttpConnection::Type protocol); + void setUpstreamProtocol(Http::CodecType protocol); // Sets fake_upstreams_count_ void setUpstreamCount(uint32_t count) { fake_upstreams_count_ = count; } // Skip validation that ensures that all upstream ports are referenced by the @@ -73,7 +73,7 @@ class BaseIntegrationTest : protected Logger::Loggable { // Make test more deterministic by using a fixed RNG value. void setDeterministic() { deterministic_ = true; } - FakeHttpConnection::Type upstreamProtocol() const { return upstream_config_.upstream_protocol_; } + Http::CodecType upstreamProtocol() const { return upstream_config_.upstream_protocol_; } IntegrationTcpClientPtr makeTcpConnection(uint32_t port, @@ -307,23 +307,23 @@ class BaseIntegrationTest : protected Logger::Loggable { *dispatcher_, std::move(transport_socket)); } - FakeUpstreamConfig configWithType(FakeHttpConnection::Type type) const { + FakeUpstreamConfig configWithType(Http::CodecType type) const { FakeUpstreamConfig config = upstream_config_; config.upstream_protocol_ = type; - if (type != FakeHttpConnection::Type::HTTP3) { + if (type != Http::CodecType::HTTP3) { config.udp_fake_upstream_ = absl::nullopt; } return config; } - FakeUpstream& addFakeUpstream(FakeHttpConnection::Type type) { + FakeUpstream& addFakeUpstream(Http::CodecType type) { auto config = configWithType(type); fake_upstreams_.emplace_back(std::make_unique(0, version_, config)); return *fake_upstreams_.back(); } FakeUpstream& addFakeUpstream(Network::TransportSocketFactoryPtr&& transport_socket_factory, - FakeHttpConnection::Type type) { + Http::CodecType type) { auto config = configWithType(type); fake_upstreams_.emplace_back( std::make_unique(std::move(transport_socket_factory), 0, version_, config)); diff --git a/test/integration/cds_integration_test.cc b/test/integration/cds_integration_test.cc index aecabc64bee69..0377cdcb1da2d 100644 --- a/test/integration/cds_integration_test.cc +++ b/test/integration/cds_integration_test.cc @@ -31,7 +31,7 @@ const int UpstreamIndex2 = 2; class CdsIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public HttpIntegrationTest { public: CdsIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), + : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), ConfigHelper::discoveredClustersBootstrap( sotwOrDelta() == Grpc::SotwOrDelta::Sotw ? "GRPC" : "DELTA_GRPC")) { use_lds_ = false; @@ -53,8 +53,8 @@ class CdsIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public Ht // BaseIntegrationTest::createUpstreams() (which is part of initialize()). // Make sure this number matches the size of the 'clusters' repeated field in the bootstrap // config that you use! - setUpstreamCount(1); // the CDS cluster - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); // CDS uses gRPC uses HTTP2. + setUpstreamCount(1); // the CDS cluster + setUpstreamProtocol(Http::CodecType::HTTP2); // CDS uses gRPC uses HTTP2. // HttpIntegrationTest::initialize() does many things: // 1) It appends to fake_upstreams_ as many as you asked for via setUpstreamCount(). @@ -71,8 +71,8 @@ class CdsIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public Ht // Create the regular (i.e. not an xDS server) upstreams. We create them manually here after // initialize() because finalize() expects all fake_upstreams_ to correspond to a static // cluster in the bootstrap config - which we don't want since we're testing dynamic CDS! - addFakeUpstream(FakeHttpConnection::Type::HTTP2); - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); cluster1_ = ConfigHelper::buildStaticCluster( ClusterName1, fake_upstreams_[UpstreamIndex1]->localAddress()->ip()->port(), Network::Test::getLoopbackAddressString(ipVersion())); diff --git a/test/integration/cluster_upstream_extension_integration_test.cc b/test/integration/cluster_upstream_extension_integration_test.cc index e4ac4ee0ba76d..dfbc519933ddc 100644 --- a/test/integration/cluster_upstream_extension_integration_test.cc +++ b/test/integration/cluster_upstream_extension_integration_test.cc @@ -20,7 +20,7 @@ class ClusterUpstreamExtensionIntegrationTest public HttpIntegrationTest { public: ClusterUpstreamExtensionIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void populateMetadataTestData(envoy::config::core::v3::Metadata& metadata, const std::string& key1, const std::string& key2, diff --git a/test/integration/command_formatter_extension_integration_test.cc b/test/integration/command_formatter_extension_integration_test.cc index 3cc1a21527dc3..fe0643b39a906 100644 --- a/test/integration/command_formatter_extension_integration_test.cc +++ b/test/integration/command_formatter_extension_integration_test.cc @@ -13,7 +13,7 @@ namespace Formatter { class CommandFormatterExtensionIntegrationTest : public testing::Test, public HttpIntegrationTest { public: CommandFormatterExtensionIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, Network::Address::IpVersion::v4) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, Network::Address::IpVersion::v4) {} }; TEST_F(CommandFormatterExtensionIntegrationTest, BasicExtension) { diff --git a/test/integration/custom_cluster_integration_test.cc b/test/integration/custom_cluster_integration_test.cc index e5553e9a87ef7..ecd21ccddf05d 100644 --- a/test/integration/custom_cluster_integration_test.cc +++ b/test/integration/custom_cluster_integration_test.cc @@ -18,8 +18,7 @@ const int UpstreamIndex = 0; class CustomClusterIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - CustomClusterIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + CustomClusterIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void initialize() override { setUpstreamCount(1); diff --git a/test/integration/direct_response_integration_test.cc b/test/integration/direct_response_integration_test.cc index da246a27f74c3..bc79926acaff7 100644 --- a/test/integration/direct_response_integration_test.cc +++ b/test/integration/direct_response_integration_test.cc @@ -6,8 +6,7 @@ namespace Envoy { class DirectResponseIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - DirectResponseIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + DirectResponseIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void TearDown() override { cleanupUpstreamAndDownstream(); } diff --git a/test/integration/drain_close_integration_test.cc b/test/integration/drain_close_integration_test.cc index 22f410e1ce69a..de57d7fcba64c 100644 --- a/test/integration/drain_close_integration_test.cc +++ b/test/integration/drain_close_integration_test.cc @@ -35,7 +35,7 @@ TEST_P(DrainCloseIntegrationTest, DrainCloseGradual) { EXPECT_TRUE(response->complete()); EXPECT_EQ("200", response->headers().getStatusValue()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ == Http::CodecType::HTTP2) { EXPECT_TRUE(codec_client_->sawGoAway()); } else { EXPECT_EQ("close", response->headers().getConnectionValue()); @@ -66,7 +66,7 @@ TEST_P(DrainCloseIntegrationTest, DrainCloseImmediate) { EXPECT_TRUE(response->complete()); EXPECT_EQ("200", response->headers().getStatusValue()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ == Http::CodecType::HTTP2) { EXPECT_TRUE(codec_client_->sawGoAway()); } else { EXPECT_EQ("close", response->headers().getConnectionValue()); @@ -108,7 +108,7 @@ TEST_P(DrainCloseIntegrationTest, AdminGracefulDrain) { // Connections will terminate on request complete ASSERT_TRUE(codec_client_->waitForDisconnect()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ == Http::CodecType::HTTP2) { EXPECT_TRUE(codec_client_->sawGoAway()); } else { EXPECT_EQ("close", response->headers().getConnectionValue()); @@ -169,8 +169,8 @@ TEST_P(DrainCloseIntegrationTest, RepeatedAdminGracefulDrain) { INSTANTIATE_TEST_SUITE_P(Protocols, DrainCloseIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, + {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); } // namespace diff --git a/test/integration/dynamic_validation_integration_test.cc b/test/integration/dynamic_validation_integration_test.cc index aab7833a53724..d9cde92eeffec 100644 --- a/test/integration/dynamic_validation_integration_test.cc +++ b/test/integration/dynamic_validation_integration_test.cc @@ -62,10 +62,10 @@ class DynamicValidationIntegrationTest public HttpIntegrationTest { public: DynamicValidationIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, std::get<0>(GetParam())), + : HttpIntegrationTest(Http::CodecType::HTTP2, std::get<0>(GetParam())), reject_unknown_dynamic_fields_(std::get<1>(GetParam())), ignore_unknown_dynamic_fields_(std::get<2>(GetParam())) { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); } void createEnvoy() override { diff --git a/test/integration/eds_integration_test.cc b/test/integration/eds_integration_test.cc index 5b742158d6998..ddef6576eab4d 100644 --- a/test/integration/eds_integration_test.cc +++ b/test/integration/eds_integration_test.cc @@ -22,7 +22,7 @@ class EdsIntegrationTest : public testing::TestWithParam( shared_connection_.connection(), stats, *this, http1_settings, max_request_headers_kb, max_request_headers_count, headers_with_underscores_action); - } else if (type == Type::HTTP2) { + } else if (type == Http::CodecType::HTTP2) { envoy::config::core::v3::Http2ProtocolOptions http2_options = fake_upstream.http2Options(); Http::Http2::CodecStats& stats = fake_upstream.http2CodecStats(); codec_ = std::make_unique( shared_connection_.connection(), *this, stats, random_, http2_options, max_request_headers_kb, max_request_headers_count, headers_with_underscores_action); } else { - ASSERT(type == Type::HTTP3); + ASSERT(type == Http::CodecType::HTTP3); #ifdef ENVOY_ENABLE_QUIC Http::Http3::CodecStats& stats = fake_upstream.http3CodecStats(); codec_ = std::make_unique( @@ -380,20 +380,20 @@ Http::RequestDecoder& FakeHttpConnection::newStream(Http::ResponseEncoder& encod } void FakeHttpConnection::onGoAway(Http::GoAwayErrorCode code) { - ASSERT(type_ >= Type::HTTP2); + ASSERT(type_ >= Http::CodecType::HTTP2); // Usually indicates connection level errors, no operations are needed since // the connection will be closed soon. ENVOY_LOG(info, "FakeHttpConnection receives GOAWAY: ", code); } void FakeHttpConnection::encodeGoAway() { - ASSERT(type_ >= Type::HTTP2); + ASSERT(type_ >= Http::CodecType::HTTP2); shared_connection_.connection().dispatcher().post([this]() { codec_->goAway(); }); } void FakeHttpConnection::encodeProtocolError() { - ASSERT(type_ >= Type::HTTP2); + ASSERT(type_ >= Http::CodecType::HTTP2); Http::Http2::ServerConnectionImpl* codec = dynamic_cast(codec_.get()); @@ -505,7 +505,7 @@ FakeUpstream::FakeUpstream(Network::TransportSocketFactoryPtr&& transport_socket dispatcher_(api_->allocateDispatcher("fake_upstream")), handler_(new Server::ConnectionHandlerImpl(*dispatcher_, 0)), config_(config), read_disable_on_new_connection_(true), enable_half_close_(config.enable_half_close_), - listener_(*this, http_type_ == FakeHttpConnection::Type::HTTP3), + listener_(*this, http_type_ == Http::CodecType::HTTP3), filter_chain_(Network::Test::createEmptyFilterChain(std::move(transport_socket_factory))) { ENVOY_LOG(info, "starting fake server at {}. UDP={} codec={}", localAddress()->asString(), config.udp_fake_upstream_.has_value(), FakeHttpConnection::typeToString(http_type_)); @@ -532,7 +532,7 @@ void FakeUpstream::cleanUp() { bool FakeUpstream::createNetworkFilterChain(Network::Connection& connection, const std::vector&) { absl::MutexLock lock(&lock_); - if (read_disable_on_new_connection_ && http_type_ != FakeHttpConnection::Type::HTTP3) { + if (read_disable_on_new_connection_ && http_type_ != Http::CodecType::HTTP3) { // Disable early close detection to avoid closing the network connection before full // initialization is complete. connection.detectEarlyCloseWhenReadDisabled(false); @@ -545,7 +545,7 @@ bool FakeUpstream::createNetworkFilterChain(Network::Connection& connection, // Normally we don't associate a logical network connection with a FakeHttpConnection until // waitForHttpConnection is called, but QUIC needs to be set up as packets come in, so we do // not lazily create for HTTP/3 - if (http_type_ == FakeHttpConnection::Type::HTTP3) { + if (http_type_ == Http::CodecType::HTTP3) { quic_connections_.push_back(std::make_unique( *this, consumeConnection(), http_type_, time_system_, config_.max_request_headers_kb_, config_.max_request_headers_count_, config_.headers_with_underscores_action_)); @@ -582,7 +582,7 @@ AssertionResult FakeUpstream::waitForHttpConnection(Event::Dispatcher& client_di // As noted in createNetworkFilterChain, HTTP3 FakeHttpConnections are not // lazily created, so HTTP3 needs a different wait path here. - if (http_type_ == FakeHttpConnection::Type::HTTP3) { + if (http_type_ == Http::CodecType::HTTP3) { if (quic_connections_.empty() && !waitForWithDispatcherRun( time_system_, lock_, @@ -691,7 +691,7 @@ SharedConnectionWrapper& FakeUpstream::consumeConnection() { connection_wrapper->setParented(); connection_wrapper->moveBetweenLists(new_connections_, consumed_connections_); if (read_disable_on_new_connection_ && connection_wrapper->connected() && - http_type_ != FakeHttpConnection::Type::HTTP3) { + http_type_ != Http::CodecType::HTTP3) { // Re-enable read and early close detection. auto& connection = connection_wrapper->connection(); connection.detectEarlyCloseWhenReadDisabled(true); diff --git a/test/integration/fake_upstream.h b/test/integration/fake_upstream.h index eb3e9ac757095..5d7660bd3252e 100644 --- a/test/integration/fake_upstream.h +++ b/test/integration/fake_upstream.h @@ -413,22 +413,24 @@ class FakeConnectionBase : public Logger::Loggable { */ class FakeHttpConnection : public Http::ServerConnectionCallbacks, public FakeConnectionBase { public: - enum class Type { HTTP1, HTTP2, HTTP3 }; - static absl::string_view typeToString(Type type) { + // This is a legacy alias. + using Type = Envoy::Http::CodecType; + // using Type = Envoy::Http::CodecType; + static absl::string_view typeToString(Http::CodecType type) { switch (type) { - case Type::HTTP1: + case Http::CodecType::HTTP1: return "http1"; - case Type::HTTP2: + case Http::CodecType::HTTP2: return "http2"; - case Type::HTTP3: + case Http::CodecType::HTTP3: return "http3"; } return "invalid"; } FakeHttpConnection(FakeUpstream& fake_upstream, SharedConnectionWrapper& shared_connection, - Type type, Event::TestTimeSystem& time_system, uint32_t max_request_headers_kb, - uint32_t max_request_headers_count, + Http::CodecType type, Event::TestTimeSystem& time_system, + uint32_t max_request_headers_kb, uint32_t max_request_headers_count, envoy::config::core::v3::HttpProtocolOptions::HeadersWithUnderscoresAction headers_with_underscores_action); @@ -475,7 +477,7 @@ class FakeHttpConnection : public Http::ServerConnectionCallbacks, public FakeCo FakeHttpConnection& parent_; }; - const Type type_; + const Http::CodecType type_; Http::ServerConnectionPtr codec_; std::list new_streams_ ABSL_GUARDED_BY(lock_); testing::NiceMock random_; @@ -559,7 +561,7 @@ struct FakeUpstreamConfig { } Event::TestTimeSystem& time_system_; - FakeHttpConnection::Type upstream_protocol_{FakeHttpConnection::Type::HTTP1}; + Http::CodecType upstream_protocol_{Http::CodecType::HTTP1}; bool enable_half_close_{}; absl::optional udp_fake_upstream_; envoy::config::core::v3::Http2ProtocolOptions http2_options_; @@ -593,7 +595,7 @@ class FakeUpstream : Logger::Loggable, Network::Address::IpVersion version, const FakeUpstreamConfig& config); ~FakeUpstream() override; - FakeHttpConnection::Type httpType() { return http_type_; } + Http::CodecType httpType() { return http_type_; } // Returns the new connection via the connection argument. ABSL_MUST_USE_RESULT @@ -678,7 +680,7 @@ class FakeUpstream : Logger::Loggable, protected: Stats::IsolatedStoreImpl stats_store_; - const FakeHttpConnection::Type http_type_; + const Http::CodecType http_type_; private: FakeUpstream(Network::TransportSocketFactoryPtr&& transport_socket_factory, diff --git a/test/integration/filter_manager_integration_test.cc b/test/integration/filter_manager_integration_test.cc index 6d4ec55cf34bf..2640f5a17472f 100644 --- a/test/integration/filter_manager_integration_test.cc +++ b/test/integration/filter_manager_integration_test.cc @@ -582,7 +582,7 @@ TEST_P(FilterChainAccessLogTest, FilterChainName) { */ class InjectDataWithHttpConnectionManagerIntegrationTest : public testing::TestWithParam< - std::tuple>, + std::tuple>, public HttpIntegrationTest, public TestWithAuxiliaryFilter { public: @@ -590,12 +590,12 @@ class InjectDataWithHttpConnectionManagerIntegrationTest // FooTestCase.BarInstance/IPv4_Http_no_inject_data static std::string testParamsToString( const testing::TestParamInfo< - std::tuple>& params) { + std::tuple>& params) { return fmt::format( "{}_{}_{}", TestUtility::ipTestParamsToString(testing::TestParamInfo( std::get<0>(params.param), params.index)), - (std::get<1>(params.param) == Http::CodecClient::Type::HTTP2 ? "Http2" : "Http"), + (std::get<1>(params.param) == Http::CodecType::HTTP2 ? "Http2" : "Http"), std::regex_replace(std::get<2>(params.param), invalid_param_name_regex(), "_")); } @@ -625,8 +625,7 @@ class InjectDataWithHttpConnectionManagerIntegrationTest INSTANTIATE_TEST_SUITE_P( Params, InjectDataWithHttpConnectionManagerIntegrationTest, testing::Combine(testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), - testing::Values(Http::CodecClient::Type::HTTP1, - Http::CodecClient::Type::HTTP2), + testing::Values(Http::CodecType::HTTP1, Http::CodecType::HTTP2), testing::ValuesIn(auxiliary_filters())), InjectDataWithHttpConnectionManagerIntegrationTest::testParamsToString); diff --git a/test/integration/h1_fuzz.h b/test/integration/h1_fuzz.h index f1179598e0e75..2d993f6b49022 100644 --- a/test/integration/h1_fuzz.h +++ b/test/integration/h1_fuzz.h @@ -12,7 +12,7 @@ namespace Envoy { class H1FuzzIntegrationTest : public HttpIntegrationTest { public: H1FuzzIntegrationTest(Network::Address::IpVersion version) - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, version) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, version) {} void initialize() override; void replay(const test::integration::CaptureFuzzTestCase&, bool ignore_response); diff --git a/test/integration/h2_capture_direct_response_fuzz_test.cc b/test/integration/h2_capture_direct_response_fuzz_test.cc index fd7c2e9ef0cc0..1c9ec4c27804c 100644 --- a/test/integration/h2_capture_direct_response_fuzz_test.cc +++ b/test/integration/h2_capture_direct_response_fuzz_test.cc @@ -9,8 +9,8 @@ void H2FuzzIntegrationTest::initialize() { const std::string prefix("/"); const Http::Code status(Http::Code::OK); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); config_helper_.addConfigModifier( [&body, &prefix]( diff --git a/test/integration/h2_capture_fuzz_test.cc b/test/integration/h2_capture_fuzz_test.cc index f07c927fd8380..51db5f87a6e7a 100644 --- a/test/integration/h2_capture_fuzz_test.cc +++ b/test/integration/h2_capture_fuzz_test.cc @@ -14,8 +14,8 @@ void H2FuzzIntegrationTest::initialize() { config_helper_.addConfigModifier( [&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& hcm) -> void { hcm.mutable_http2_protocol_options()->set_allow_metadata(true); }); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); } diff --git a/test/integration/h2_fuzz.h b/test/integration/h2_fuzz.h index 48498d7854324..97a19b9ebc272 100644 --- a/test/integration/h2_fuzz.h +++ b/test/integration/h2_fuzz.h @@ -14,7 +14,7 @@ namespace Envoy { class H2FuzzIntegrationTest : public HttpIntegrationTest { public: H2FuzzIntegrationTest(Network::Address::IpVersion version) - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, version) {} + : HttpIntegrationTest(Http::CodecType::HTTP2, version) {} void initialize() override; void replay(const test::integration::H2CaptureFuzzTestCase&, bool ignore_response); diff --git a/test/integration/hds_integration_test.cc b/test/integration/hds_integration_test.cc index 63ae64a0b500c..15ef2c8f36d1e 100644 --- a/test/integration/hds_integration_test.cc +++ b/test/integration/hds_integration_test.cc @@ -30,10 +30,10 @@ namespace { class HdsIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, public HttpIntegrationTest { public: - HdsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + HdsIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} void createUpstreams() override { - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); hds_upstream_ = fake_upstreams_.back().get(); HttpIntegrationTest::createUpstreams(); } @@ -370,7 +370,7 @@ class HdsIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, FakeHttpConnectionPtr host_fake_connection_; FakeHttpConnectionPtr host2_fake_connection_; FakeRawConnectionPtr host_fake_raw_connection_; - FakeHttpConnection::Type http_conn_type_{FakeHttpConnection::Type::HTTP1}; + Http::CodecType http_conn_type_{Http::CodecType::HTTP1}; bool tls_hosts_{false}; static constexpr int MaxTimeout = 100; @@ -959,7 +959,7 @@ TEST_P(HdsIntegrationTest, SingleEndpointHealthyTlsHttp2) { tls_hosts_ = true; // Change hosts to operate over HTTP/2 instead of default HTTP. - http_conn_type_ = FakeHttpConnection::Type::HTTP2; + http_conn_type_ = Http::CodecType::HTTP2; initialize(); diff --git a/test/integration/header_casing_integration_test.cc b/test/integration/header_casing_integration_test.cc index c5707660ec826..f16994578c98b 100644 --- a/test/integration/header_casing_integration_test.cc +++ b/test/integration/header_casing_integration_test.cc @@ -13,11 +13,11 @@ namespace Envoy { class HeaderCasingIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - HeaderCasingIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + HeaderCasingIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void SetUp() override { - setDownstreamProtocol(Http::CodecClient::Type::HTTP1); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP1); + setDownstreamProtocol(Http::CodecType::HTTP1); + setUpstreamProtocol(Http::CodecType::HTTP1); } void initialize() override { diff --git a/test/integration/header_integration_test.cc b/test/integration/header_integration_test.cc index 073c05bf097b2..0d6c37098d2cb 100644 --- a/test/integration/header_integration_test.cc +++ b/test/integration/header_integration_test.cc @@ -180,8 +180,7 @@ class HeaderIntegrationTest : public testing::TestWithParam>, public HttpIntegrationTest { public: - HeaderIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, std::get<0>(GetParam())) {} + HeaderIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, std::get<0>(GetParam())) {} bool routerSuppressEnvoyHeaders() const { return std::get<1>(GetParam()); } @@ -370,7 +369,7 @@ class HeaderIntegrationTest HttpIntegrationTest::createUpstreams(); if (use_eds_) { - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } } diff --git a/test/integration/header_prefix_integration_test.cc b/test/integration/header_prefix_integration_test.cc index 52ca839c76072..99db2e41393c6 100644 --- a/test/integration/header_prefix_integration_test.cc +++ b/test/integration/header_prefix_integration_test.cc @@ -60,7 +60,7 @@ TEST_P(HeaderPrefixIntegrationTest, FailedCustomHeaderPrefix) { INSTANTIATE_TEST_SUITE_P(Protocols, HeaderPrefixIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, + {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); } // namespace Envoy diff --git a/test/integration/health_check_integration_test.cc b/test/integration/health_check_integration_test.cc index e280b3d2b4cf2..5870929ce3e9b 100644 --- a/test/integration/health_check_integration_test.cc +++ b/test/integration/health_check_integration_test.cc @@ -17,10 +17,9 @@ namespace { // checking after Envoy and the hosts are initialized. class HealthCheckIntegrationTestBase : public HttpIntegrationTest { public: - HealthCheckIntegrationTestBase( - Network::Address::IpVersion ip_version, - FakeHttpConnection::Type upstream_protocol = FakeHttpConnection::Type::HTTP2) - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ip_version, + HealthCheckIntegrationTestBase(Network::Address::IpVersion ip_version, + Http::CodecType upstream_protocol = Http::CodecType::HTTP2) + : HttpIntegrationTest(Http::CodecType::HTTP2, ip_version, ConfigHelper::discoveredClustersBootstrap("GRPC")), ip_version_(ip_version), upstream_protocol_(upstream_protocol) {} @@ -48,8 +47,8 @@ class HealthCheckIntegrationTestBase : public HttpIntegrationTest { // BaseIntegrationTest::createUpstreams() (which is part of initialize()). // Make sure this number matches the size of the 'clusters' repeated field in the bootstrap // config that you use! - setUpstreamCount(1); // the CDS cluster - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); // CDS uses gRPC uses HTTP2. + setUpstreamCount(1); // the CDS cluster + setUpstreamProtocol(Http::CodecType::HTTP2); // CDS uses gRPC uses HTTP2. // HttpIntegrationTest::initialize() does many things: // 1) It appends to fake_upstreams_ as many as you asked for via setUpstreamCount(). @@ -126,12 +125,12 @@ class HealthCheckIntegrationTestBase : public HttpIntegrationTest { static constexpr size_t clusters_num_ = 2; std::array clusters_{{{"cluster_1"}, {"cluster_2"}}}; Network::Address::IpVersion ip_version_; - FakeHttpConnection::Type upstream_protocol_; + Http::CodecType upstream_protocol_; }; struct HttpHealthCheckIntegrationTestParams { Network::Address::IpVersion ip_version; - FakeHttpConnection::Type upstream_protocol; + Http::CodecType upstream_protocol; }; class HttpHealthCheckIntegrationTestBase @@ -148,8 +147,7 @@ class HttpHealthCheckIntegrationTestBase std::vector ret; for (auto ip_version : TestEnvironment::getIpVersionsForTest()) { - for (auto upstream_protocol : - {FakeHttpConnection::Type::HTTP1, FakeHttpConnection::Type::HTTP2}) { + for (auto upstream_protocol : {Http::CodecType::HTTP1, Http::CodecType::HTTP2}) { ret.push_back(HttpHealthCheckIntegrationTestParams{ip_version, upstream_protocol}); } } @@ -160,8 +158,8 @@ class HttpHealthCheckIntegrationTestBase const ::testing::TestParamInfo& params) { return absl::StrCat( (params.param.ip_version == Network::Address::IpVersion::v4 ? "IPv4_" : "IPv6_"), - (params.param.upstream_protocol == FakeHttpConnection::Type::HTTP2 ? "Http2Upstream" - : "HttpUpstream")); + (params.param.upstream_protocol == Http::CodecType::HTTP2 ? "Http2Upstream" + : "HttpUpstream")); } void TearDown() override { @@ -173,9 +171,8 @@ class HttpHealthCheckIntegrationTestBase // check probe to be received. void initHttpHealthCheck(uint32_t cluster_idx) { const envoy::type::v3::CodecClientType codec_client_type = - (FakeHttpConnection::Type::HTTP1 == upstream_protocol_) - ? envoy::type::v3::CodecClientType::HTTP1 - : envoy::type::v3::CodecClientType::HTTP2; + (Http::CodecType::HTTP1 == upstream_protocol_) ? envoy::type::v3::CodecClientType::HTTP1 + : envoy::type::v3::CodecClientType::HTTP2; auto& cluster_data = clusters_[cluster_idx]; auto* health_check = addHealthCheck(cluster_data.cluster_); @@ -315,7 +312,7 @@ TEST_P(HttpHealthCheckIntegrationTest, SingleEndpointGoAway) { initialize(); // GOAWAY doesn't exist in HTTP1. - if (upstream_protocol_ == FakeHttpConnection::Type::HTTP1) { + if (upstream_protocol_ == Http::CodecType::HTTP1) { return; } @@ -377,7 +374,7 @@ TEST_P(RealTimeHttpHealthCheckIntegrationTest, SingleEndpointGoAwayErroSingleEnd initialize(); // GOAWAY doesn't exist in HTTP1. - if (upstream_protocol_ == FakeHttpConnection::Type::HTTP1) { + if (upstream_protocol_ == Http::CodecType::HTTP1) { return; } diff --git a/test/integration/http2_flood_integration_test.cc b/test/integration/http2_flood_integration_test.cc index 9d900353cb615..7abef9b1c8805 100644 --- a/test/integration/http2_flood_integration_test.cc +++ b/test/integration/http2_flood_integration_test.cc @@ -131,8 +131,8 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, Http2FloodMitigationTest, TestUtility::ipTestParamsToString); bool Http2FloodMitigationTest::initializeUpstreamFloodTest() { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); // set lower upstream outbound frame limits to make tests run faster config_helper_.setUpstreamOutboundFramesLimits(AllFrameFloodLimit, ControlFrameFloodLimit); initialize(); @@ -158,8 +158,8 @@ void Http2FloodMitigationTest::setNetworkConnectionBufferSize() { } void Http2FloodMitigationTest::beginSession() { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); // set lower outbound frame limits to make tests run faster config_helper_.setDownstreamOutboundFramesLimits(AllFrameFloodLimit, ControlFrameFloodLimit); initialize(); @@ -1554,8 +1554,8 @@ TEST_P(Http2FloodMitigationTest, RequestMetadata) { // Validate that the default configuration has flood protection enabled. TEST_P(Http2FloodMitigationTest, UpstreamFloodDetectionIsOnByDefault) { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); initialize(); floodClient(Http2Frame::makePingFrame(), diff --git a/test/integration/http_integration.cc b/test/integration/http_integration.cc index 2c225369cb8f4..90853a554d73b 100644 --- a/test/integration/http_integration.cc +++ b/test/integration/http_integration.cc @@ -55,15 +55,15 @@ namespace { using testing::HasSubstr; envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager::CodecType -typeToCodecType(Http::CodecClient::Type type) { +typeToCodecType(Http::CodecType type) { switch (type) { - case Http::CodecClient::Type::HTTP1: + case Http::CodecType::HTTP1: return envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager:: HTTP1; - case Http::CodecClient::Type::HTTP2: + case Http::CodecType::HTTP2: return envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager:: HTTP2; - case Http::CodecClient::Type::HTTP3: + case Http::CodecType::HTTP3: return envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager:: HTTP3; default: @@ -76,7 +76,7 @@ typeToCodecType(Http::CodecClient::Type type) { IntegrationCodecClient::IntegrationCodecClient( Event::Dispatcher& dispatcher, Random::RandomGenerator& random, Network::ClientConnectionPtr&& conn, Upstream::HostDescriptionConstSharedPtr host_description, - CodecClient::Type type) + Http::CodecType type) : CodecClientProd(type, std::move(conn), host_description, dispatcher, random), dispatcher_(dispatcher), callbacks_(*this), codec_callbacks_(*this) { connection_->addConnectionCallbacks(callbacks_); @@ -208,7 +208,7 @@ void IntegrationCodecClient::ConnectionCallbacks::onEvent(Network::ConnectionEve parent_.disconnected_ = true; parent_.connection_->dispatcher().exit(); } else { - if (parent_.type() == CodecClient::Type::HTTP3 && !parent_.connected_) { + if (parent_.type() == Http::CodecType::HTTP3 && !parent_.connected_) { // Before handshake gets established, any connection failure should exit the loop. I.e. a QUIC // connection may fail of INVALID_VERSION if both this client doesn't support any of the // versions the server advertised before handshake established. In this case the connection is @@ -221,7 +221,7 @@ void IntegrationCodecClient::ConnectionCallbacks::onEvent(Network::ConnectionEve Network::ClientConnectionPtr HttpIntegrationTest::makeClientConnectionWithOptions( uint32_t port, const Network::ConnectionSocket::OptionsSharedPtr& options) { - if (downstream_protocol_ <= Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ <= Http::CodecType::HTTP2) { return BaseIntegrationTest::makeClientConnectionWithOptions(port, options); } #ifdef ENVOY_ENABLE_QUIC @@ -270,7 +270,7 @@ IntegrationCodecClientPtr HttpIntegrationTest::makeRawHttpConnection( // in-connection version negotiation. auto codec = std::make_unique(*dispatcher_, random_, std::move(conn), host_description, downstream_protocol_); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP3 && codec->disconnected()) { + if (downstream_protocol_ == Http::CodecType::HTTP3 && codec->disconnected()) { // Connection may get closed during version negotiation or handshake. // TODO(#8479) QUIC connection doesn't support in-connection version negotiationPropagate // INVALID_VERSION error to caller and let caller to use server advertised version list to @@ -288,7 +288,7 @@ HttpIntegrationTest::makeHttpConnection(Network::ClientConnectionPtr&& conn) { return codec; } -HttpIntegrationTest::HttpIntegrationTest(Http::CodecClient::Type downstream_protocol, +HttpIntegrationTest::HttpIntegrationTest(Http::CodecType downstream_protocol, Network::Address::IpVersion version, const std::string& config) : HttpIntegrationTest::HttpIntegrationTest( @@ -299,7 +299,7 @@ HttpIntegrationTest::HttpIntegrationTest(Http::CodecClient::Type downstream_prot }, version, config) {} -HttpIntegrationTest::HttpIntegrationTest(Http::CodecClient::Type downstream_protocol, +HttpIntegrationTest::HttpIntegrationTest(Http::CodecType downstream_protocol, const InstanceConstSharedPtrFn& upstream_address_fn, Network::Address::IpVersion version, const std::string& config) @@ -321,7 +321,7 @@ void HttpIntegrationTest::useAccessLog( HttpIntegrationTest::~HttpIntegrationTest() { cleanupUpstreamAndDownstream(); } void HttpIntegrationTest::initialize() { - if (downstream_protocol_ != Http::CodecClient::Type::HTTP3) { + if (downstream_protocol_ != Http::CodecType::HTTP3) { return BaseIntegrationTest::initialize(); } #ifdef ENVOY_ENABLE_QUIC @@ -356,7 +356,7 @@ void HttpIntegrationTest::initialize() { #endif } -void HttpIntegrationTest::setDownstreamProtocol(Http::CodecClient::Type downstream_protocol) { +void HttpIntegrationTest::setDownstreamProtocol(Http::CodecType downstream_protocol) { downstream_protocol_ = downstream_protocol; config_helper_.setClientCodec(typeToCodecType(downstream_protocol_)); } @@ -369,7 +369,7 @@ ConfigHelper::HttpModifierFunction HttpIntegrationTest::setEnableDownstreamTrail ConfigHelper::ConfigModifierFunction HttpIntegrationTest::setEnableUpstreamTrailersHttp1() { return [&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() == 1, ""); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ConfigHelper::HttpProtocolOptions protocol_options; protocol_options.mutable_explicit_http_config() ->mutable_http_protocol_options() @@ -671,7 +671,7 @@ void HttpIntegrationTest::testRouterUpstreamDisconnectBeforeRequestComplete() { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -699,7 +699,7 @@ void HttpIntegrationTest::testRouterUpstreamDisconnectBeforeResponseComplete( ASSERT_TRUE(fake_upstream_connection_->close()); ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { ASSERT_TRUE(response->waitForReset()); @@ -727,7 +727,7 @@ void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeRequestComplete( ASSERT_TRUE(upstream_request_->waitForHeadersComplete()); codec_client_->close(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -746,7 +746,7 @@ void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeResponseComplete( #if defined(__APPLE__) || defined(WIN32) // Skip this test on OS/X + Windows: we can't detect the early close, and we // won't clean up the upstream connection until it times out. See #4294. - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { return; } #endif @@ -760,7 +760,7 @@ void HttpIntegrationTest::testRouterDownstreamDisconnectBeforeResponseComplete( response->waitForBodyData(512); codec_client_->close(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -788,7 +788,7 @@ void HttpIntegrationTest::testRouterUpstreamResponseBeforeRequestComplete() { upstream_request_->encodeData(512, true); ASSERT_TRUE(response->waitForEndStream()); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -796,7 +796,7 @@ void HttpIntegrationTest::testRouterUpstreamResponseBeforeRequestComplete() { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -824,7 +824,7 @@ void HttpIntegrationTest::testRetry() { waitForNextUpstreamRequest(); upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "503"}}, false); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -866,7 +866,7 @@ void HttpIntegrationTest::testRetryAttemptCountHeader() { EXPECT_EQ(atoi(std::string(upstream_request_->headers().getEnvoyAttemptCountValue()).c_str()), 1); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -905,7 +905,7 @@ void HttpIntegrationTest::testGrpcRetry() { waitForNextUpstreamRequest(); upstream_request_->encodeHeaders( Http::TestResponseHeaderMapImpl{{":status", "200"}, {"grpc-status", "1"}}, false); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -914,9 +914,8 @@ void HttpIntegrationTest::testGrpcRetry() { waitForNextUpstreamRequest(); upstream_request_->encodeHeaders(default_response_headers_, false); - upstream_request_->encodeData(512, - fake_upstreams_[0]->httpType() != FakeHttpConnection::Type::HTTP2); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP2) { + upstream_request_->encodeData(512, fake_upstreams_[0]->httpType() != Http::CodecType::HTTP2); + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP2) { upstream_request_->encodeTrailers(response_trailers); } @@ -927,7 +926,7 @@ void HttpIntegrationTest::testGrpcRetry() { EXPECT_TRUE(response->complete()); EXPECT_EQ("200", response->headers().getStatusValue()); EXPECT_EQ(512U, response->body().size()); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP2) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP2) { EXPECT_THAT(*response->trailers(), HeaderMapEqualRef(&response_trailers)); } } @@ -1091,7 +1090,7 @@ void HttpIntegrationTest::testTwoRequests(bool network_backup) { typed_config: "@type": type.googleapis.com/google.protobuf.Empty )EOF", - downstreamProtocol() == Http::CodecClient::Type::HTTP3 ? "-for-quic" : "")); + downstreamProtocol() == Http::CodecType::HTTP3 ? "-for-quic" : "")); } initialize(); @@ -1148,7 +1147,7 @@ void HttpIntegrationTest::testLargeRequestUrl(uint32_t url_size, uint32_t max_he auto encoder_decoder = codec_client_->startRequest(big_headers); auto response = std::move(encoder_decoder.second); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); EXPECT_TRUE(response->complete()); EXPECT_EQ("431", response->headers().Status()->value().getStringView()); @@ -1197,7 +1196,7 @@ void HttpIntegrationTest::testLargeRequestHeaders(uint32_t size, uint32_t count, auto encoder_decoder = codec_client_->startRequest(big_headers); auto response = std::move(encoder_decoder.second); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); EXPECT_TRUE(response->complete()); EXPECT_EQ("431", response->headers().getStatusValue()); @@ -1239,7 +1238,7 @@ void HttpIntegrationTest::testLargeRequestTrailers(uint32_t size, uint32_t max_s codec_client_->sendTrailers(*request_encoder_, request_trailers); if (size >= max_size) { - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); EXPECT_TRUE(response->complete()); EXPECT_EQ("431", response->headers().getStatusValue()); @@ -1316,7 +1315,7 @@ void HttpIntegrationTest::testDownstreamResetBeforeResponseComplete() { response->waitForBodyData(512); codec_client_->sendReset(*request_encoder_); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -1376,7 +1375,7 @@ void HttpIntegrationTest::testTrailers(uint64_t request_size, uint64_t response_ } } -void HttpIntegrationTest::testAdminDrain(Http::CodecClient::Type admin_request_type) { +void HttpIntegrationTest::testAdminDrain(Http::CodecType admin_request_type) { initialize(); uint32_t http_port = lookupPort("http"); @@ -1413,7 +1412,7 @@ void HttpIntegrationTest::testAdminDrain(Http::CodecClient::Type admin_request_t // Validate that port is closed and can be bound by other sockets. // This does not work for HTTP/3 because the port is not closed until the listener is completely // destroyed. TODO(danzh) Match TCP behavior as much as possible. - if (downstreamProtocol() != Http::CodecClient::Type::HTTP3) { + if (downstreamProtocol() != Http::CodecType::HTTP3) { ASSERT_TRUE(waitForPortAvailable(http_port)); } } @@ -1440,7 +1439,7 @@ void HttpIntegrationTest::testMaxStreamDuration() { test_server_->waitForCounterGe("cluster.cluster_0.upstream_rq_max_duration_reached", 1); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { ASSERT_TRUE(response->waitForEndStream()); @@ -1472,7 +1471,7 @@ void HttpIntegrationTest::testMaxStreamDurationWithRetry(bool invoke_retry_upstr ASSERT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, upstream_request_)); ASSERT_TRUE(upstream_request_->waitForHeadersComplete()); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -1485,7 +1484,7 @@ void HttpIntegrationTest::testMaxStreamDurationWithRetry(bool invoke_retry_upstr if (invoke_retry_upstream_disconnect) { test_server_->waitForCounterGe("cluster.cluster_0.upstream_rq_max_duration_reached", 2); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { ASSERT_TRUE(response->waitForEndStream()); @@ -1532,8 +1531,8 @@ void Http2RawFrameIntegrationTest::startHttp2Session() { } void Http2RawFrameIntegrationTest::beginSession() { - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); // set lower outbound frame limits to make tests run faster config_helper_.setDownstreamOutboundFramesLimits(1000, 100); initialize(); diff --git a/test/integration/http_integration.h b/test/integration/http_integration.h index 23227ce7f2fbe..9e9943e3648b2 100644 --- a/test/integration/http_integration.h +++ b/test/integration/http_integration.h @@ -25,7 +25,7 @@ class IntegrationCodecClient : public Http::CodecClientProd { IntegrationCodecClient(Event::Dispatcher& dispatcher, Random::RandomGenerator& random, Network::ClientConnectionPtr&& conn, Upstream::HostDescriptionConstSharedPtr host_description, - Http::CodecClient::Type type); + Http::CodecType type); IntegrationStreamDecoderPtr makeHeaderOnlyRequest(const Http::RequestHeaderMap& headers); IntegrationStreamDecoderPtr makeRequestWithBody(const Http::RequestHeaderMap& headers, @@ -89,11 +89,10 @@ using IntegrationCodecClientPtr = std::unique_ptr; */ class HttpIntegrationTest : public BaseIntegrationTest { public: - HttpIntegrationTest(Http::CodecClient::Type downstream_protocol, - Network::Address::IpVersion version, + HttpIntegrationTest(Http::CodecType downstream_protocol, Network::Address::IpVersion version, const std::string& config = ConfigHelper::httpProxyConfig()); - HttpIntegrationTest(Http::CodecClient::Type downstream_protocol, + HttpIntegrationTest(Http::CodecType downstream_protocol, const InstanceConstSharedPtrFn& upstream_address_fn, Network::Address::IpVersion version, const std::string& config = ConfigHelper::httpProxyConfig()); @@ -118,7 +117,7 @@ class HttpIntegrationTest : public BaseIntegrationTest { // Sets downstream_protocol_ and alters the HTTP connection manager codec type in the // config_helper_. - void setDownstreamProtocol(Http::CodecClient::Type type); + void setDownstreamProtocol(Http::CodecType type); // Enable the encoding/decoding of Http1 trailers downstream ConfigHelper::HttpModifierFunction setEnableDownstreamTrailersHttp1(); @@ -238,11 +237,11 @@ class HttpIntegrationTest : public BaseIntegrationTest { void testTrailers(uint64_t request_size, uint64_t response_size, bool request_trailers_present, bool response_trailers_present); // Test /drain_listener from admin portal. - void testAdminDrain(Http::CodecClient::Type admin_request_type); + void testAdminDrain(Http::CodecType admin_request_type); // Test max stream duration. void testMaxStreamDuration(); void testMaxStreamDurationWithRetry(bool invoke_retry_upstream_disconnect); - Http::CodecClient::Type downstreamProtocol() const { return downstream_protocol_; } + Http::CodecType downstreamProtocol() const { return downstream_protocol_; } // Prefix listener stat with IP:port, including IP version dependent loopback address. std::string listenerStatPrefix(const std::string& stat_name); @@ -263,7 +262,7 @@ class HttpIntegrationTest : public BaseIntegrationTest { Http::TestRequestHeaderMapImpl default_request_headers_{ {":method", "GET"}, {":path", "/test/long/url"}, {":scheme", "http"}, {":authority", "host"}}; // The codec type for the client-to-Envoy connection - Http::CodecClient::Type downstream_protocol_{Http::CodecClient::Type::HTTP1}; + Http::CodecType downstream_protocol_{Http::CodecType::HTTP1}; std::string access_log_name_; testing::NiceMock random_; @@ -275,7 +274,7 @@ class HttpIntegrationTest : public BaseIntegrationTest { class Http2RawFrameIntegrationTest : public HttpIntegrationTest { public: Http2RawFrameIntegrationTest(Network::Address::IpVersion version) - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, version) {} + : HttpIntegrationTest(Http::CodecType::HTTP2, version) {} protected: void startHttp2Session(); diff --git a/test/integration/http_protocol_integration.cc b/test/integration/http_protocol_integration.cc index 5bdcd4aa9c5ff..0538a024d2541 100644 --- a/test/integration/http_protocol_integration.cc +++ b/test/integration/http_protocol_integration.cc @@ -4,8 +4,8 @@ namespace Envoy { std::vector HttpProtocolIntegrationTest::getProtocolTestParams( - const std::vector& downstream_protocols, - const std::vector& upstream_protocols) { + const std::vector& downstream_protocols, + const std::vector& upstream_protocols) { std::vector ret; for (auto ip_version : TestEnvironment::getIpVersionsForTest()) { @@ -14,8 +14,8 @@ std::vector HttpProtocolIntegrationTest::getProtocolTest #ifdef ENVOY_ENABLE_QUIC ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol}); #else - if (downstream_protocol == Http::CodecClient::Type::HTTP3 || - upstream_protocol == FakeHttpConnection::Type::HTTP3) { + if (downstream_protocol == Http::CodecType::HTTP3 || + upstream_protocol == Http::CodecType::HTTP3) { ENVOY_LOG_MISC(warn, "Skipping HTTP/3 as support is compiled out"); } else { ret.push_back(HttpProtocolTestParams{ip_version, downstream_protocol, upstream_protocol}); @@ -27,25 +27,25 @@ std::vector HttpProtocolIntegrationTest::getProtocolTest return ret; } -absl::string_view upstreamToString(FakeHttpConnection::Type type) { +absl::string_view upstreamToString(Http::CodecType type) { switch (type) { - case FakeHttpConnection::Type::HTTP1: + case Http::CodecType::HTTP1: return "HttpUpstream"; - case FakeHttpConnection::Type::HTTP2: + case Http::CodecType::HTTP2: return "Http2Upstream"; - case FakeHttpConnection::Type::HTTP3: + case Http::CodecType::HTTP3: return "Http3Upstream"; } return "UnknownUpstream"; } -absl::string_view downstreamToString(Http::CodecClient::Type type) { +absl::string_view downstreamToString(Http::CodecType type) { switch (type) { - case Http::CodecClient::Type::HTTP1: + case Http::CodecType::HTTP1: return "HttpDownstream_"; - case Http::CodecClient::Type::HTTP2: + case Http::CodecType::HTTP2: return "Http2Downstream_"; - case Http::CodecClient::Type::HTTP3: + case Http::CodecType::HTTP3: return "Http3Downstream_"; } return "UnknownDownstream"; diff --git a/test/integration/http_protocol_integration.h b/test/integration/http_protocol_integration.h index 05a91eed1bb1d..d66f53692919d 100644 --- a/test/integration/http_protocol_integration.h +++ b/test/integration/http_protocol_integration.h @@ -8,8 +8,8 @@ namespace Envoy { struct HttpProtocolTestParams { Network::Address::IpVersion version; - Http::CodecClient::Type downstream_protocol; - FakeHttpConnection::Type upstream_protocol; + Http::CodecType downstream_protocol; + Http::CodecType upstream_protocol; }; // Allows easy testing of Envoy code for HTTP/HTTP2 upstream/downstream. @@ -37,11 +37,11 @@ class HttpProtocolIntegrationTest : public testing::TestWithParam - getProtocolTestParams(const std::vector& downstream_protocols = - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - const std::vector& upstream_protocols = { - FakeHttpConnection::Type::HTTP1, FakeHttpConnection::Type::HTTP2}); + static std::vector getProtocolTestParams( + const std::vector& downstream_protocols = {Http::CodecType::HTTP1, + Http::CodecType::HTTP2}, + const std::vector& upstream_protocols = {Http::CodecType::HTTP1, + Http::CodecType::HTTP2}); // Allows pretty printed test names of the form // FooTestCase.BarInstance/IPv4_Http2Downstream_HttpUpstream @@ -52,7 +52,7 @@ class HttpProtocolIntegrationTest : public testing::TestWithParamwaitForDisconnect()); } else { ASSERT_TRUE(response.waitForReset()); @@ -357,7 +357,7 @@ TEST_P(IdleTimeoutIntegrationTest, RequestTimeoutUnconfiguredDoesNotTriggerOnBod TEST_P(IdleTimeoutIntegrationTest, RequestTimeoutTriggersOnRawIncompleteRequestWithHeaders) { // Omitting \r\n\r\n does not indicate incomplete request in HTTP2 - if (downstreamProtocol() == Envoy::Http::CodecClient::Type::HTTP2) { + if (downstreamProtocol() == Envoy::Http::CodecType::HTTP2) { return; } enable_request_timeout_ = true; @@ -370,7 +370,7 @@ TEST_P(IdleTimeoutIntegrationTest, RequestTimeoutTriggersOnRawIncompleteRequestW } TEST_P(IdleTimeoutIntegrationTest, RequestTimeoutDoesNotTriggerOnRawCompleteRequestWithHeaders) { - if (downstreamProtocol() == Envoy::Http::CodecClient::Type::HTTP2) { + if (downstreamProtocol() == Envoy::Http::CodecType::HTTP2) { return; } enable_request_timeout_ = true; diff --git a/test/integration/instantiate_protocol_integration_test.cc b/test/integration/instantiate_protocol_integration_test.cc index d789995f91701..b5c219a8c521a 100644 --- a/test/integration/instantiate_protocol_integration_test.cc +++ b/test/integration/instantiate_protocol_integration_test.cc @@ -6,8 +6,8 @@ namespace Envoy { // run with both HTTP/1 and HTTP/2 upstreams. INSTANTIATE_TEST_SUITE_P(Protocols, DownstreamProtocolIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, + {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); INSTANTIATE_TEST_SUITE_P(Protocols, ProtocolIntegrationTest, diff --git a/test/integration/integration_admin_test.cc b/test/integration/integration_admin_test.cc index 84622c5c92378..dd6e62d2bdfa9 100644 --- a/test/integration/integration_admin_test.cc +++ b/test/integration/integration_admin_test.cc @@ -30,8 +30,8 @@ namespace Envoy { INSTANTIATE_TEST_SUITE_P(Protocols, IntegrationAdminTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, + {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); TEST_P(IntegrationAdminTest, HealthCheck) { @@ -280,19 +280,19 @@ TEST_P(IntegrationAdminTest, Admin) { EXPECT_EQ("text/plain; charset=UTF-8", ContentType(response)); switch (GetParam().downstream_protocol) { - case Http::CodecClient::Type::HTTP1: + case Http::CodecType::HTTP1: EXPECT_EQ(" Count Lookup\n" "\n" "total: 0\n", response->body()); break; - case Http::CodecClient::Type::HTTP2: + case Http::CodecType::HTTP2: EXPECT_EQ(" Count Lookup\n" "\n" "total: 0\n", response->body()); break; - case Http::CodecClient::Type::HTTP3: + case Http::CodecType::HTTP3: NOT_IMPLEMENTED_GCOVR_EXCL_LINE; } @@ -490,7 +490,7 @@ TEST_P(IntegrationAdminTest, AdminCpuProfilerStart) { class IntegrationAdminIpv4Ipv6Test : public testing::Test, public HttpIntegrationTest { public: IntegrationAdminIpv4Ipv6Test() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, Network::Address::IpVersion::v4) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, Network::Address::IpVersion::v4) {} void initialize() override { config_helper_.addConfigModifier( @@ -530,7 +530,7 @@ class StatsMatcherIntegrationTest public HttpIntegrationTest, public testing::WithParamInterface { public: - StatsMatcherIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + StatsMatcherIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void initialize() override { config_helper_.addConfigModifier( diff --git a/test/integration/integration_test.cc b/test/integration/integration_test.cc index a1ace5f25b9bf..192e80fe74e6c 100644 --- a/test/integration/integration_test.cc +++ b/test/integration/integration_test.cc @@ -638,7 +638,7 @@ TEST_P(IntegrationTest, TestServerAllowChunkedLength) { TEST_P(IntegrationTest, TestClientAllowChunkedLength) { config_helper_.addConfigModifier([&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void { RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() == 1, ""); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ConfigHelper::HttpProtocolOptions protocol_options; protocol_options.mutable_explicit_http_config() ->mutable_http_protocol_options() diff --git a/test/integration/integration_test.h b/test/integration/integration_test.h index 2af85a268ec9c..e36f2e0b6301b 100644 --- a/test/integration/integration_test.h +++ b/test/integration/integration_test.h @@ -9,7 +9,7 @@ namespace Envoy { class IntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - IntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + IntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} }; class UpstreamEndpointIntegrationTest : public testing::TestWithParam, @@ -17,7 +17,7 @@ class UpstreamEndpointIntegrationTest : public testing::TestWithParam stream_by_resource_name_; }; - ListenerIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + ListenerIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} ~ListenerIntegrationTest() override { resetConnections(); } @@ -98,9 +98,9 @@ class ListenerIntegrationTest : public HttpIntegrationTest, void createUpstreams() override { HttpIntegrationTest::createUpstreams(); // Create the LDS upstream (fake_upstreams_[1]). - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); // Create the RDS upstream (fake_upstreams_[2]). - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void resetFakeUpstreamInfo(FakeUpstreamInfo* upstream_info) { diff --git a/test/integration/load_stats_integration_test.cc b/test/integration/load_stats_integration_test.cc index bda71d612a88c..630db22619042 100644 --- a/test/integration/load_stats_integration_test.cc +++ b/test/integration/load_stats_integration_test.cc @@ -20,7 +20,7 @@ namespace { class LoadStatsIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest, public HttpIntegrationTest { public: - LoadStatsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) { + LoadStatsIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) { // We rely on some fairly specific load balancing picks in this test, so // determinize the schedule. setDeterministic(); @@ -99,7 +99,7 @@ class LoadStatsIntegrationTest : public Grpc::VersionedGrpcClientIntegrationPara } void createUpstreams() override { - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); load_report_upstream_ = fake_upstreams_.back().get(); HttpIntegrationTest::createUpstreams(); } diff --git a/test/integration/local_reply_integration_test.cc b/test/integration/local_reply_integration_test.cc index 778158f01bd4b..fb9225a88bad3 100644 --- a/test/integration/local_reply_integration_test.cc +++ b/test/integration/local_reply_integration_test.cc @@ -66,7 +66,7 @@ TEST_P(LocalReplyIntegrationTest, MapStatusCodeAndFormatToJson) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -125,7 +125,7 @@ TEST_P(LocalReplyIntegrationTest, EmptyStructFormatter) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -177,7 +177,7 @@ TEST_P(LocalReplyIntegrationTest, MapStatusCodeAndFormatToJson4Grpc) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -256,7 +256,7 @@ TEST_P(LocalReplyIntegrationTest, MapStatusCodeAndFormatToJsonForFirstMatchingFi ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -330,7 +330,7 @@ TEST_P(LocalReplyIntegrationTest, ShouldNotMatchAnyFilter) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -391,7 +391,7 @@ TEST_P(LocalReplyIntegrationTest, ShouldMapResponseCodeAndMapToDefaultTextRespon ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -449,7 +449,7 @@ TEST_P(LocalReplyIntegrationTest, ShouldFormatResponseToCustomString) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); @@ -507,7 +507,7 @@ TEST_P(LocalReplyIntegrationTest, ShouldFormatResponseToEmptyBody) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(response->waitForEndStream()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); diff --git a/test/integration/multiplexed_integration_test.cc b/test/integration/multiplexed_integration_test.cc index 63a976a738e03..7c853be095078 100644 --- a/test/integration/multiplexed_integration_test.cc +++ b/test/integration/multiplexed_integration_test.cc @@ -27,14 +27,14 @@ namespace Envoy { // TODO(#2557) fix all the failures. #define EXCLUDE_DOWNSTREAM_HTTP3 \ - if (downstreamProtocol() == Http::CodecClient::Type::HTTP3) { \ + if (downstreamProtocol() == Http::CodecType::HTTP3) { \ return; \ } INSTANTIATE_TEST_SUITE_P(IpVersions, Http2IntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP2, Http::CodecClient::Type::HTTP3}, - {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP2, Http::CodecType::HTTP3}, + {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); TEST_P(Http2IntegrationTest, RouterRequestAndResponseWithBodyNoBuffer) { @@ -902,7 +902,7 @@ TEST_P(Http2IntegrationTest, CodecErrorAfterStreamStart) { } TEST_P(Http2IntegrationTest, Http2BadMagic) { - if (downstreamProtocol() == Http::CodecClient::Type::HTTP3) { + if (downstreamProtocol() == Http::CodecType::HTTP3) { // The "magic" payload is an HTTP/2 specific thing. return; } @@ -1401,18 +1401,18 @@ Http2RingHashIntegrationTest::~Http2RingHashIntegrationTest() { void Http2RingHashIntegrationTest::createUpstreams() { for (int i = 0; i < num_upstreams_; i++) { - addFakeUpstream(FakeHttpConnection::Type::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); } } INSTANTIATE_TEST_SUITE_P(IpVersions, Http2RingHashIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP2}, {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); INSTANTIATE_TEST_SUITE_P(IpVersions, Http2MetadataIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP2})), + {Http::CodecType::HTTP2}, {Http::CodecType::HTTP2})), HttpProtocolIntegrationTest::protocolTestParamsToString); void Http2RingHashIntegrationTest::sendMultipleRequests( diff --git a/test/integration/multiplexed_upstream_integration_test.cc b/test/integration/multiplexed_upstream_integration_test.cc index 2c86cba32fb0a..39f394c9d173a 100644 --- a/test/integration/multiplexed_upstream_integration_test.cc +++ b/test/integration/multiplexed_upstream_integration_test.cc @@ -17,14 +17,14 @@ namespace Envoy { INSTANTIATE_TEST_SUITE_P(Protocols, Http2UpstreamIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP2})), + {Http::CodecType::HTTP2}, {Http::CodecType::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})), + {Http::CodecType::HTTP2}, {Http::CodecType::HTTP3})), HttpProtocolIntegrationTest::protocolTestParamsToString); #endif @@ -309,7 +309,7 @@ TEST_P(Http2UpstreamIntegrationTest, ManyLargeSimultaneousRequestWithRandomBacku name: pause-filter{} typed_config: "@type": type.googleapis.com/google.protobuf.Empty)EOF", - downstreamProtocol() == Http::CodecClient::Type::HTTP3 ? "-for-quic" : "")); + downstreamProtocol() == Http::CodecType::HTTP3 ? "-for-quic" : "")); manySimultaneousRequests(1024 * 20, 1024 * 20); } @@ -609,18 +609,18 @@ class MixedUpstreamIntegrationTest : public Http2UpstreamIntegrationTest { Http2UpstreamIntegrationTest::initialize(); } void createUpstreams() override { - ASSERT_EQ(upstreamProtocol(), FakeHttpConnection::Type::HTTP3); + ASSERT_EQ(upstreamProtocol(), Http::CodecType::HTTP3); ASSERT_EQ(fake_upstreams_count_, 1); ASSERT_FALSE(autonomous_upstream_); if (use_http2_) { - auto config = configWithType(FakeHttpConnection::Type::HTTP2); + auto config = configWithType(Http::CodecType::HTTP2); Network::TransportSocketFactoryPtr factory = createUpstreamTlsContext(config); - addFakeUpstream(std::move(factory), FakeHttpConnection::Type::HTTP2); + addFakeUpstream(std::move(factory), Http::CodecType::HTTP2); } else { - auto config = configWithType(FakeHttpConnection::Type::HTTP3); + auto config = configWithType(Http::CodecType::HTTP3); Network::TransportSocketFactoryPtr factory = createUpstreamTlsContext(config); - addFakeUpstream(std::move(factory), FakeHttpConnection::Type::HTTP3); + addFakeUpstream(std::move(factory), Http::CodecType::HTTP3); } } @@ -638,7 +638,7 @@ TEST_P(MixedUpstreamIntegrationTest, SimultaneousRequestAutoWithHttp2) { INSTANTIATE_TEST_SUITE_P(Protocols, MixedUpstreamIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP2}, {FakeHttpConnection::Type::HTTP3})), + {Http::CodecType::HTTP2}, {Http::CodecType::HTTP3})), HttpProtocolIntegrationTest::protocolTestParamsToString); #endif diff --git a/test/integration/multiplexed_upstream_integration_test.h b/test/integration/multiplexed_upstream_integration_test.h index 45e35a83b42e6..a07ea32469987 100644 --- a/test/integration/multiplexed_upstream_integration_test.h +++ b/test/integration/multiplexed_upstream_integration_test.h @@ -9,8 +9,7 @@ class Http2UpstreamIntegrationTest : public HttpProtocolIntegrationTest { public: void initialize() override { upstream_tls_ = true; - config_helper_.configureUpstreamTls(use_alpn_, - upstreamProtocol() == FakeHttpConnection::Type::HTTP3); + config_helper_.configureUpstreamTls(use_alpn_, upstreamProtocol() == Http::CodecType::HTTP3); HttpProtocolIntegrationTest::initialize(); } diff --git a/test/integration/original_ip_detection_integration_test.cc b/test/integration/original_ip_detection_integration_test.cc index 9fa25edce17e2..8bc353e0da494 100644 --- a/test/integration/original_ip_detection_integration_test.cc +++ b/test/integration/original_ip_detection_integration_test.cc @@ -15,8 +15,7 @@ class OriginalIPDetectionIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - OriginalIPDetectionIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + OriginalIPDetectionIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void runTest(const std::string& ip) { useAccessLog("%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%"); diff --git a/test/integration/overload_integration_test.cc b/test/integration/overload_integration_test.cc index 055cc6a3d4144..e284321697bea 100644 --- a/test/integration/overload_integration_test.cc +++ b/test/integration/overload_integration_test.cc @@ -168,7 +168,7 @@ TEST_P(OverloadIntegrationTest, CloseStreamsWhenOverloaded) { } TEST_P(OverloadIntegrationTest, DisableKeepaliveWhenOverloaded) { - if (downstreamProtocol() != Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() != Http::CodecType::HTTP1) { return; // only relevant for downstream HTTP1.x connections } @@ -305,7 +305,7 @@ TEST_P(OverloadScaledTimerIntegrationTest, CloseIdleHttpConnections) { test_server_->waitForCounterGe("http.config_test.downstream_cx_idle_timeout", 1); dispatcher_->run(Event::Dispatcher::RunType::NonBlock); - if (GetParam().downstream_protocol == Http::CodecClient::Type::HTTP1) { + if (GetParam().downstream_protocol == Http::CodecType::HTTP1) { // For HTTP1, Envoy will start draining but will wait to close the // connection. If a new stream comes in, it will set the connection header // to "close" on the response and close the connection after. diff --git a/test/integration/protocol_integration_test.cc b/test/integration/protocol_integration_test.cc index b8ab19fda6c9e..0f5f79ff3de0d 100644 --- a/test/integration/protocol_integration_test.cc +++ b/test/integration/protocol_integration_test.cc @@ -55,7 +55,7 @@ void setDoNotValidateRouteConfig( // TODO(#2557) fix all the failures. #define EXCLUDE_DOWNSTREAM_HTTP3 \ - if (downstreamProtocol() == Http::CodecClient::Type::HTTP3) { \ + if (downstreamProtocol() == Http::CodecType::HTTP3) { \ return; \ } @@ -301,7 +301,7 @@ name: add-trailers-filter upstream_request_->encodeData(128, true); ASSERT_TRUE(response->waitForEndStream()); - if (upstreamProtocol() >= FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() >= Http::CodecType::HTTP2) { EXPECT_EQ("decode", upstream_request_->trailers() ->get(Http::LowerCaseString("grpc-message"))[0] ->value() @@ -309,7 +309,7 @@ name: add-trailers-filter } EXPECT_TRUE(response->complete()); EXPECT_EQ("503", response->headers().getStatusValue()); - if (downstream_protocol_ >= Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ >= Http::CodecType::HTTP2) { EXPECT_EQ("encode", response->trailers()->getGrpcMessageValue()); } } @@ -335,7 +335,7 @@ TEST_P(ProtocolIntegrationTest, ResponseWithHostHeader) { // Tests missing headers needed for H/1 codec first line. TEST_P(DownstreamProtocolIntegrationTest, DownstreamRequestWithFaultyFilter) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (upstreamProtocol() == Http::CodecType::HTTP3) { // For QUIC, even through the headers are not sent upstream, the stream will // be created. Use the autonomous upstream and allow incomplete streams. autonomous_allow_incomplete_streams_ = true; @@ -375,7 +375,7 @@ TEST_P(DownstreamProtocolIntegrationTest, DownstreamRequestWithFaultyFilter) { TEST_P(DownstreamProtocolIntegrationTest, FaultyFilterWithConnect) { // TODO(danzh) re-enable after adding http3 option "allow_connect". EXCLUDE_DOWNSTREAM_HTTP3; - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (upstreamProtocol() == Http::CodecType::HTTP3) { // For QUIC, even through the headers are not sent upstream, the stream will // be created. Use the autonomous upstream and allow incomplete streams. autonomous_allow_incomplete_streams_ = true; @@ -403,7 +403,7 @@ TEST_P(DownstreamProtocolIntegrationTest, FaultyFilterWithConnect) { auto headers = Http::TestRequestHeaderMapImpl{ {":method", "CONNECT"}, {":scheme", "http"}, {":authority", "www.host.com:80"}}; - auto response = (downstream_protocol_ == Http::CodecClient::Type::HTTP1) + auto response = (downstream_protocol_ == Http::CodecType::HTTP1) ? std::move((codec_client_->startRequest(headers)).second) : codec_client_->makeHeaderOnlyRequest(headers); @@ -507,7 +507,7 @@ TEST_P(ProtocolIntegrationTest, Retry) { waitForNextUpstreamRequest(); upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "503"}}, false); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_, std::chrono::milliseconds(500))); @@ -526,12 +526,12 @@ TEST_P(ProtocolIntegrationTest, Retry) { EXPECT_EQ("200", response->headers().getStatusValue()); EXPECT_EQ(512U, response->body().size()); Stats::Store& stats = test_server_->server().stats(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() == Http::CodecType::HTTP2) { Stats::CounterSharedPtr counter = TestUtility::findCounter(stats, "cluster.cluster_0.http2.tx_reset"); ASSERT_NE(nullptr, counter); EXPECT_EQ(1L, counter->value()); - } else if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + } else if (upstreamProtocol() == Http::CodecType::HTTP3) { // TODO(alyssawilk) http3 stats. Stats::CounterSharedPtr counter = TestUtility::findCounter(stats, "cluster.cluster_0.upstream_rq_tx_reset"); @@ -568,7 +568,7 @@ TEST_P(ProtocolIntegrationTest, RetryStreaming) { // Send back an upstream failure. upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "503"}}, false); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -631,7 +631,7 @@ TEST_P(ProtocolIntegrationTest, RetryStreamingReset) { }); // Make sure the fake stream is reset. - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -698,7 +698,7 @@ TEST_P(ProtocolIntegrationTest, RetryStreamingCancelDueToBufferOverflow) { // Send back an upstream failure. upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "503"}}, false); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -740,7 +740,7 @@ TEST_P(DownstreamProtocolIntegrationTest, RetryAttemptCountHeader) { EXPECT_EQ(atoi(std::string(upstream_request_->headers().getEnvoyAttemptCountValue()).c_str()), 1); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { @@ -811,14 +811,14 @@ TEST_P(DownstreamProtocolIntegrationTest, RetryPriority) { waitForNextUpstreamRequest(0); upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "503"}}, false); - if (fake_upstreams_[0]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[0]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[1]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); } else { ASSERT_TRUE(upstream_request_->waitForReset()); } - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (upstreamProtocol() == Http::CodecType::HTTP3) { // Make sure waitForNextUpstreamRequest waits for a new connection. fake_upstream_connection_.reset(); } @@ -878,7 +878,7 @@ TEST_P(DownstreamProtocolIntegrationTest, RetryHostPredicateFilter) { ASSERT_TRUE(upstream_idx.has_value()); upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "503"}}, false); - if (fake_upstreams_[*upstream_idx]->httpType() == FakeHttpConnection::Type::HTTP1) { + if (fake_upstreams_[*upstream_idx]->httpType() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); ASSERT_TRUE(fake_upstreams_[*upstream_idx]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); @@ -978,7 +978,7 @@ TEST_P(DownstreamProtocolIntegrationTest, HittingDecoderFilterLimit) { // the 413-and-connection-close may be sent while the body is still being // sent, resulting in a write error and the connection being closed before the // response is read. - if (downstream_protocol_ >= Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ >= Http::CodecType::HTTP2) { ASSERT_TRUE(response->complete()); } if (response->complete()) { @@ -1020,7 +1020,7 @@ TEST_P(ProtocolIntegrationTest, HittingEncoderFilterLimit) { // Now send an overly large response body. At some point, too much data will // be buffered, the stream will be reset, and the connection will disconnect. upstream_request_->encodeData(1024 * 65, false); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -1116,13 +1116,13 @@ TEST_P(ProtocolIntegrationTest, HeadersWithUnderscoresDropped) { Stats::Store& stats = test_server_->server().stats(); std::string stat_name; switch (downstreamProtocol()) { - case Http::CodecClient::Type::HTTP1: + case Http::CodecType::HTTP1: stat_name = "http1.dropped_headers_with_underscores"; break; - case Http::CodecClient::Type::HTTP2: + case Http::CodecType::HTTP2: stat_name = "http2.dropped_headers_with_underscores"; break; - case Http::CodecClient::Type::HTTP3: + case Http::CodecType::HTTP3: stat_name = "http3.dropped_headers_with_underscores"; break; default: @@ -1171,7 +1171,7 @@ TEST_P(DownstreamProtocolIntegrationTest, HeadersWithUnderscoresCauseRequestReje {":authority", "host"}, {"foo_bar", "baz"}}); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); ASSERT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); @@ -1218,15 +1218,15 @@ TEST_P(ProtocolIntegrationTest, 304WithBody) { // For HTTP/1.1 http_parser is explicitly told that 304s are header-only // requests. - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1 || - upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1 || + upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(response->complete()); } else { ASSERT_FALSE(response->complete()); } upstream_request_->encodeData(2, true); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { // Any body sent after the request is considered complete will not be handled as part of the // active request, but will be flagged as a protocol error for the no-longer-associated // connection. @@ -1239,8 +1239,8 @@ TEST_P(ProtocolIntegrationTest, 304WithBody) { // Only for HTTP/2 and Http/3, where streams are ended with an explicit end-stream so we // can differentiate between 304-with-advertised-but-absent-body and // 304-with-body, is there a protocol error on the active stream. - if (downstream_protocol_ >= Http::CodecClient::Type::HTTP2 && - upstreamProtocol() >= FakeHttpConnection::Type::HTTP2) { + if (downstream_protocol_ >= Http::CodecType::HTTP2 && + upstreamProtocol() >= Http::CodecType::HTTP2) { ASSERT_TRUE(response->waitForReset()); } } @@ -1251,7 +1251,7 @@ TEST_P(ProtocolIntegrationTest, OverflowingResponseCode) { codec_client_ = makeHttpConnection(lookupPort("http")); auto response = codec_client_->makeHeaderOnlyRequest(default_request_headers_); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { // The http1 codec won't send illegal status codes so send raw HTTP/1.1 FakeRawConnectionPtr fake_upstream_connection; ASSERT_TRUE(fake_upstreams_[0]->waitForRawConnection(fake_upstream_connection)); @@ -1280,13 +1280,13 @@ TEST_P(ProtocolIntegrationTest, MissingStatus) { codec_client_ = makeHttpConnection(lookupPort("http")); auto response = codec_client_->makeHeaderOnlyRequest(default_request_headers_); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { FakeRawConnectionPtr fake_upstream_connection; ASSERT_TRUE(fake_upstreams_[0]->waitForRawConnection(fake_upstream_connection)); ASSERT(fake_upstream_connection != nullptr); ASSERT_TRUE(fake_upstream_connection->write("HTTP/1.1 OK\r\n", false)); ASSERT_TRUE(fake_upstream_connection->waitForDisconnect()); - } else if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + } else if (upstreamProtocol() == Http::CodecType::HTTP2) { FakeRawConnectionPtr fake_upstream_connection; ASSERT_TRUE(fake_upstreams_[0]->waitForRawConnection(fake_upstream_connection)); Http::Http2::Http2Frame::SettingsFlags settings_flags = @@ -1314,7 +1314,7 @@ TEST_P(ProtocolIntegrationTest, MissingStatus) { // Validate that lots of tiny cookies doesn't cause a DoS (single cookie header). TEST_P(DownstreamProtocolIntegrationTest, LargeCookieParsingConcatenated) { - if (downstreamProtocol() == Http::CodecClient::Type::HTTP3) { + if (downstreamProtocol() == Http::CodecType::HTTP3) { // QUICHE Qpack splits concatenated cookies into crumbs to increase // compression ratio. On the receiver side, the total size of these crumbs // may be larger than coalesced cookie headers. Increase the max request @@ -1326,7 +1326,7 @@ TEST_P(DownstreamProtocolIntegrationTest, LargeCookieParsingConcatenated) { hcm.mutable_common_http_protocol_options()->mutable_max_headers_count()->set_value(8000); }); } - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (upstreamProtocol() == Http::CodecType::HTTP3) { setMaxRequestHeadersKb(96); setMaxRequestHeadersCount(8000); } @@ -1393,7 +1393,7 @@ TEST_P(DownstreamProtocolIntegrationTest, InvalidContentLength) { ASSERT_TRUE(codec_client_->waitForDisconnect()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); test_server_->waitForCounterGe("http.config_test.downstream_rq_4xx", 1); @@ -1429,14 +1429,14 @@ TEST_P(DownstreamProtocolIntegrationTest, InvalidContentLengthAllowed) { {"content-length", "-1"}}); auto response = std::move(encoder_decoder.second); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { ASSERT_TRUE(response->waitForReset()); codec_client_->close(); } - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); } else { @@ -1457,7 +1457,7 @@ TEST_P(DownstreamProtocolIntegrationTest, MultipleContentLengths) { ASSERT_TRUE(codec_client_->waitForDisconnect()); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); } else { @@ -1488,14 +1488,14 @@ TEST_P(DownstreamProtocolIntegrationTest, MultipleContentLengthsAllowed) { {"content-length", "3,2"}}); auto response = std::move(encoder_decoder.second); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { ASSERT_TRUE(response->waitForReset()); codec_client_->close(); } - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); } else { @@ -1572,7 +1572,7 @@ TEST_P(DownstreamProtocolIntegrationTest, LargeRequestHeadersRejected) { TEST_P(DownstreamProtocolIntegrationTest, VeryLargeRequestHeadersRejected) { #ifdef WIN32 // TODO(alyssawilk, wrowe) debug. - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (upstreamProtocol() == Http::CodecType::HTTP3) { return; } #endif @@ -1626,7 +1626,7 @@ TEST_P(DownstreamProtocolIntegrationTest, ManyRequestTrailersRejected) { codec_client_->sendData(*request_encoder_, 1, false); codec_client_->sendTrailers(*request_encoder_, request_trailers); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); EXPECT_TRUE(response->complete()); EXPECT_EQ("431", response->headers().getStatusValue()); @@ -1749,7 +1749,7 @@ TEST_P(ProtocolIntegrationTest, LargeRequestMethod) { initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { auto encoder_decoder = codec_client_->startRequest(request_headers); request_encoder_ = &encoder_decoder.first; auto response = std::move(encoder_decoder.second); @@ -1757,8 +1757,8 @@ TEST_P(ProtocolIntegrationTest, LargeRequestMethod) { EXPECT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); } else { - ASSERT(downstreamProtocol() >= Http::CodecClient::Type::HTTP2); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + ASSERT(downstreamProtocol() >= Http::CodecType::HTTP2); + if (upstreamProtocol() == Http::CodecType::HTTP1) { auto response = codec_client_->makeHeaderOnlyRequest(request_headers); ASSERT_TRUE( fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_)); @@ -1766,7 +1766,7 @@ TEST_P(ProtocolIntegrationTest, LargeRequestMethod) { EXPECT_TRUE(response->complete()); EXPECT_EQ("400", response->headers().getStatusValue()); } else { - ASSERT(upstreamProtocol() >= FakeHttpConnection::Type::HTTP2); + ASSERT(upstreamProtocol() >= Http::CodecType::HTTP2); auto response = sendRequestAndWaitForResponse(request_headers, 0, default_response_headers_, 0); EXPECT_TRUE(response->complete()); @@ -1964,12 +1964,12 @@ name: encode-headers-return-stop-all-filter ASSERT_TRUE(response->waitForEndStream()); ASSERT_TRUE(response->complete()); // Data is added in encodeData for all protocols, and encodeTrailers for HTTP/2 and above. - int times_added = (upstreamProtocol() == FakeHttpConnection::Type::HTTP1 || - downstreamProtocol() == Http::CodecClient::Type::HTTP1) + int times_added = (upstreamProtocol() == Http::CodecType::HTTP1 || + downstreamProtocol() == Http::CodecType::HTTP1) ? 1 : 2; - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1 && - upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (downstreamProtocol() == Http::CodecType::HTTP1 && + upstreamProtocol() == Http::CodecType::HTTP3) { // TODO(alyssawilk) Figure out why the bytes mismatch with the test expectation below. return; } @@ -2016,12 +2016,12 @@ name: encode-headers-return-stop-all-filter ASSERT_TRUE(response->waitForEndStream()); ASSERT_TRUE(response->complete()); // Data is added in encodeData for all protocols, and encodeTrailers for HTTP/2 and above. - int times_added = (upstreamProtocol() == FakeHttpConnection::Type::HTTP1 || - downstreamProtocol() == Http::CodecClient::Type::HTTP1) + int times_added = (upstreamProtocol() == Http::CodecType::HTTP1 || + downstreamProtocol() == Http::CodecType::HTTP1) ? 1 : 2; - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1 && - upstreamProtocol() == FakeHttpConnection::Type::HTTP3) { + if (downstreamProtocol() == Http::CodecType::HTTP1 && + upstreamProtocol() == Http::CodecType::HTTP3) { // TODO(alyssawilk) Figure out why the bytes mismatch with the test expectation below. return; } @@ -2063,13 +2063,13 @@ TEST_P(ProtocolIntegrationTest, TestDownstreamResetIdleTimeout) { EXPECT_TRUE(fake_upstream_connection_->waitForNewStream(*dispatcher_, upstream_request_)); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { codec_client_->close(); } else { codec_client_->sendReset(encoder_decoder.first); } - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -2157,7 +2157,7 @@ TEST_P(DownstreamProtocolIntegrationTest, TestPreconnect) { auto response = sendRequestAndWaitForResponse(default_request_headers_, 0, default_response_headers_, 0); FakeHttpConnectionPtr fake_upstream_connection_two; - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { // For HTTP/1.1 there should be a preconnected connection. ASSERT_TRUE( fake_upstreams_[0]->waitForHttpConnection(*dispatcher_, fake_upstream_connection_two)); @@ -2219,7 +2219,7 @@ TEST_P(DownstreamProtocolIntegrationTest, InvalidAuthority) { {":authority", "ho|st|"}}; auto response = codec_client_->makeHeaderOnlyRequest(request_headers); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { // For HTTP/1 this is handled by the HCM, which sends a full 400 response. ASSERT_TRUE(response->waitForEndStream()); ASSERT_TRUE(response->complete()); @@ -2240,7 +2240,7 @@ TEST_P(DownstreamProtocolIntegrationTest, ConnectIsBlocked) { request_encoder_ = &encoder_decoder.first; auto response = std::move(encoder_decoder.second); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + 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()); @@ -2257,7 +2257,7 @@ TEST_P(DownstreamProtocolIntegrationTest, ConnectIsBlocked) { TEST_P(DownstreamProtocolIntegrationTest, ConnectStreamRejection) { // TODO(danzh) add "allow_connect" to http3 options. EXCLUDE_DOWNSTREAM_HTTP3; - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { return; } config_helper_.addConfigModifier( diff --git a/test/integration/protocol_integration_test.h b/test/integration/protocol_integration_test.h index 953111451954b..fdebe2034f8d7 100644 --- a/test/integration/protocol_integration_test.h +++ b/test/integration/protocol_integration_test.h @@ -42,7 +42,7 @@ class DownstreamProtocolIntegrationTest : public HttpProtocolIntegrationTest { } void verifyUpStreamRequestAfterStopAllFilter() { - if (downstreamProtocol() >= Http::CodecClient::Type::HTTP2) { + if (downstreamProtocol() >= Http::CodecType::HTTP2) { // decode-headers-return-stop-all-filter calls addDecodedData in decodeData and // decodeTrailers. 2 decoded data were added. EXPECT_EQ(count_ * size_ + added_decoded_data_size_ * 2, upstream_request_->bodyLength()); diff --git a/test/integration/proxy_proto_integration_test.cc b/test/integration/proxy_proto_integration_test.cc index b678c4d2977b5..6a5f060303858 100644 --- a/test/integration/proxy_proto_integration_test.cc +++ b/test/integration/proxy_proto_integration_test.cc @@ -30,7 +30,7 @@ insertProxyProtocolFilterConfigModifier(envoy::config::bootstrap::v3::Bootstrap& } ProxyProtoIntegrationTest::ProxyProtoIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) { + : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) { config_helper_.addConfigModifier(insertProxyProtocolFilterConfigModifier); } diff --git a/test/integration/quic_http_integration_test.cc b/test/integration/quic_http_integration_test.cc index 8f6ce0c4bc69b..24c9fa9f7885f 100644 --- a/test/integration/quic_http_integration_test.cc +++ b/test/integration/quic_http_integration_test.cc @@ -70,7 +70,7 @@ void updateResource(AtomicFileUpdater& updater, double pressure) { class QuicHttpIntegrationTest : public HttpIntegrationTest, public QuicMultiVersionTest { public: QuicHttpIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP3, GetParam().first, + : HttpIntegrationTest(Http::CodecType::HTTP3, GetParam().first, ConfigHelper::quicHttpProxyConfig()), supported_versions_([]() { if (GetParam().second == QuicVersionType::GquicQuicCrypto) { @@ -548,7 +548,7 @@ TEST_P(QuicHttpIntegrationTest, NoNewStreamsWhenOverloaded) { } TEST_P(QuicHttpIntegrationTest, AdminDrainDrainsListeners) { - testAdminDrain(Http::CodecClient::Type::HTTP1); + testAdminDrain(Http::CodecType::HTTP1); } TEST_P(QuicHttpIntegrationTest, CertVerificationFailure) { diff --git a/test/integration/quic_protocol_integration_test.cc b/test/integration/quic_protocol_integration_test.cc index 197eb3761c7f2..94601c9356b79 100644 --- a/test/integration/quic_protocol_integration_test.cc +++ b/test/integration/quic_protocol_integration_test.cc @@ -5,27 +5,27 @@ namespace Envoy { // These will run with HTTP/3 downstream, and Http upstream. INSTANTIATE_TEST_SUITE_P(DownstreamProtocols, DownstreamProtocolIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP3}, {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP3}, {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); // These will run with HTTP/3 downstream, and Http and HTTP/2 upstream. INSTANTIATE_TEST_SUITE_P(DownstreamProtocols, ProtocolIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP3}, - {FakeHttpConnection::Type::HTTP1, FakeHttpConnection::Type::HTTP2})), + {Http::CodecType::HTTP3}, + {Http::CodecType::HTTP1, Http::CodecType::HTTP2})), HttpProtocolIntegrationTest::protocolTestParamsToString); // These will run with HTTP/1 and HTTP/2 downstream, and HTTP/3 upstream. INSTANTIATE_TEST_SUITE_P(UpstreamProtocols, DownstreamProtocolIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - {FakeHttpConnection::Type::HTTP3})), + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, + {Http::CodecType::HTTP3})), HttpProtocolIntegrationTest::protocolTestParamsToString); INSTANTIATE_TEST_SUITE_P(UpstreamProtocols, ProtocolIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2}, - {FakeHttpConnection::Type::HTTP3})), + {Http::CodecType::HTTP1, Http::CodecType::HTTP2}, + {Http::CodecType::HTTP3})), HttpProtocolIntegrationTest::protocolTestParamsToString); } // namespace Envoy diff --git a/test/integration/redirect_integration_test.cc b/test/integration/redirect_integration_test.cc index 4fac5f20765dc..68f0193948a56 100644 --- a/test/integration/redirect_integration_test.cc +++ b/test/integration/redirect_integration_test.cc @@ -397,7 +397,7 @@ TEST_P(RedirectIntegrationTest, InternalRedirectCancelledDueToEarlyResponse) { upstream_request_->encodeHeaders(redirect_response_, true); ASSERT_TRUE(response->waitForEndStream()); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -405,7 +405,7 @@ TEST_P(RedirectIntegrationTest, InternalRedirectCancelledDueToEarlyResponse) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { codec_client_->close(); diff --git a/test/integration/rtds_integration_test.cc b/test/integration/rtds_integration_test.cc index 5114d1078849e..114b24a67957f 100644 --- a/test/integration/rtds_integration_test.cc +++ b/test/integration/rtds_integration_test.cc @@ -83,7 +83,7 @@ class RtdsIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public H public: RtdsIntegrationTest() : HttpIntegrationTest( - Http::CodecClient::Type::HTTP2, ipVersion(), + Http::CodecType::HTTP2, ipVersion(), tdsBootstrapConfig(sotwOrDelta() == Grpc::SotwOrDelta::Sotw ? "GRPC" : "DELTA_GRPC")) { use_lds_ = false; create_xds_upstream_ = true; @@ -96,7 +96,7 @@ class RtdsIntegrationTest : public Grpc::DeltaSotwIntegrationParamTest, public H // The tests infra expects the xDS server to be the second fake upstream, so // we need a dummy data plane cluster. setUpstreamCount(1); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); // Register admin port. registerTestServerPorts({}); diff --git a/test/integration/scoped_rds_integration_test.cc b/test/integration/scoped_rds_integration_test.cc index 0de02704c054c..2a4d1df07b0e3 100644 --- a/test/integration/scoped_rds_integration_test.cc +++ b/test/integration/scoped_rds_integration_test.cc @@ -29,7 +29,7 @@ class ScopedRdsIntegrationTest : public HttpIntegrationTest, absl::flat_hash_map stream_by_resource_name_; }; - ScopedRdsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()) {} + ScopedRdsIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()) {} ~ScopedRdsIntegrationTest() override { resetConnections(); } @@ -125,9 +125,9 @@ class ScopedRdsIntegrationTest : public HttpIntegrationTest, void createUpstreams() override { HttpIntegrationTest::createUpstreams(); // Create the SRDS upstream. - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); // Create the RDS upstream. - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void resetFakeUpstreamInfo(FakeUpstreamInfo* upstream_info) { diff --git a/test/integration/sds_dynamic_integration_test.cc b/test/integration/sds_dynamic_integration_test.cc index 19b2636fcb5fb..563414e7d6b84 100644 --- a/test/integration/sds_dynamic_integration_test.cc +++ b/test/integration/sds_dynamic_integration_test.cc @@ -82,11 +82,11 @@ class SdsDynamicIntegrationBaseTest : public Grpc::BaseGrpcClientIntegrationPara public testing::TestWithParam { public: SdsDynamicIntegrationBaseTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam().ip_version), + : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam().ip_version), server_cert_("server_cert"), validation_secret_("validation_secret"), client_cert_("client_cert"), test_quic_(GetParam().test_quic) {} - SdsDynamicIntegrationBaseTest(Http::CodecClient::Type downstream_protocol, + SdsDynamicIntegrationBaseTest(Http::CodecType downstream_protocol, Network::Address::IpVersion version, const std::string& config) : HttpIntegrationTest(downstream_protocol, version, config), server_cert_("server_cert"), validation_secret_("validation_secret"), client_cert_("client_cert"), @@ -192,14 +192,13 @@ class SdsDynamicIntegrationBaseTest : public Grpc::BaseGrpcClientIntegrationPara class SdsDynamicDownstreamIntegrationTest : public SdsDynamicIntegrationBaseTest { public: SdsDynamicDownstreamIntegrationTest() - : SdsDynamicIntegrationBaseTest((GetParam().test_quic ? Http::CodecClient::Type::HTTP3 - : Http::CodecClient::Type::HTTP1), - GetParam().ip_version, - ConfigHelper::httpProxyConfig(GetParam().test_quic)) {} + : SdsDynamicIntegrationBaseTest( + (GetParam().test_quic ? Http::CodecType::HTTP3 : Http::CodecType::HTTP1), + GetParam().ip_version, ConfigHelper::httpProxyConfig(GetParam().test_quic)) {} void initialize() override { - ASSERT(test_quic_ ? downstream_protocol_ == Http::CodecClient::Type::HTTP3 - : downstream_protocol_ == Http::CodecClient::Type::HTTP1); + ASSERT(test_quic_ ? downstream_protocol_ == Http::CodecType::HTTP3 + : downstream_protocol_ == Http::CodecType::HTTP1); config_helper_.addConfigModifier([this](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { config_helper_.configDownstreamTransportSocketWithTls( bootstrap, @@ -256,7 +255,7 @@ class SdsDynamicDownstreamIntegrationTest : public SdsDynamicIntegrationBaseTest Network::ClientConnectionPtr makeSslClientConnection() { int port = lookupPort("http"); - if (downstream_protocol_ <= Http::CodecClient::Type::HTTP2) { + if (downstream_protocol_ <= Http::CodecType::HTTP2) { Network::Address::InstanceConstSharedPtr address = getSslAddress(version_, port); return dispatcher_->createClientConnection( address, Network::Address::InstanceConstSharedPtr(), @@ -643,7 +642,7 @@ class SdsDynamicUpstreamIntegrationTest : public SdsDynamicIntegrationBaseTest { void initialize() override { if (test_quic_) { upstream_tls_ = true; - setUpstreamProtocol(FakeHttpConnection::Type::HTTP3); + setUpstreamProtocol(Http::CodecType::HTTP3); } config_helper_.addConfigModifier([this](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { // add sds cluster first. @@ -746,7 +745,7 @@ TEST_P(SdsDynamicUpstreamIntegrationTest, WrongSecretFirst) { EXPECT_EQ("503", response->headers().getStatusValue()); // Wait for the raw TCP connection with bad credentials and close it. - if (upstreamProtocol() != FakeHttpConnection::Type::HTTP3) { + if (upstreamProtocol() != Http::CodecType::HTTP3) { FakeRawConnectionPtr fake_upstream_connection; ASSERT_TRUE(fake_upstreams_[0]->waitForRawConnection(fake_upstream_connection)); ASSERT_TRUE(fake_upstream_connection->waitForDisconnect()); @@ -831,11 +830,11 @@ class SdsCdsIntegrationTest : public SdsDynamicIntegrationBaseTest { void createUpstreams() override { // Static cluster. - addFakeUpstream(FakeHttpConnection::Type::HTTP1); + addFakeUpstream(Http::CodecType::HTTP1); // Cds Cluster. - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); // Sds Cluster. - addFakeUpstream(FakeHttpConnection::Type::HTTP2); + addFakeUpstream(Http::CodecType::HTTP2); } void sendCdsResponse() { diff --git a/test/integration/sds_generic_secret_integration_test.cc b/test/integration/sds_generic_secret_integration_test.cc index 9cf1019fc6dc1..e830dce4a2344 100644 --- a/test/integration/sds_generic_secret_integration_test.cc +++ b/test/integration/sds_generic_secret_integration_test.cc @@ -90,7 +90,7 @@ class SdsGenericSecretIntegrationTest : public Grpc::GrpcClientIntegrationParamT public HttpIntegrationTest { public: SdsGenericSecretIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, ipVersion()), registration_(factory_) {} + : HttpIntegrationTest(Http::CodecType::HTTP1, ipVersion()), registration_(factory_) {} void initialize() override { config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { diff --git a/test/integration/sds_static_integration_test.cc b/test/integration/sds_static_integration_test.cc index 8e0be765e98fa..97636f2516201 100644 --- a/test/integration/sds_static_integration_test.cc +++ b/test/integration/sds_static_integration_test.cc @@ -35,8 +35,7 @@ class SdsStaticDownstreamIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - SdsStaticDownstreamIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + SdsStaticDownstreamIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void initialize() override { config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { @@ -110,8 +109,7 @@ TEST_P(SdsStaticDownstreamIntegrationTest, RouterRequestAndResponseWithGiantBody class SdsStaticUpstreamIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - SdsStaticUpstreamIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + SdsStaticUpstreamIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void initialize() override { config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { @@ -146,8 +144,7 @@ class SdsStaticUpstreamIntegrationTest : public testing::TestWithParamcomplete()); EXPECT_EQ("200", response->headers().getStatusValue()); server_gone_.WaitForNotification(); diff --git a/test/integration/tcp_proxy_integration_test.cc b/test/integration/tcp_proxy_integration_test.cc index 8cb605c65ba3a..532337a848dc7 100644 --- a/test/integration/tcp_proxy_integration_test.cc +++ b/test/integration/tcp_proxy_integration_test.cc @@ -114,7 +114,7 @@ TEST_P(TcpProxyIntegrationTest, TcpProxyUpstreamWritesFirst) { // Test TLS upstream. TEST_P(TcpProxyIntegrationTest, TcpProxyUpstreamTls) { upstream_tls_ = true; - setUpstreamProtocol(FakeHttpConnection::Type::HTTP1); + setUpstreamProtocol(Http::CodecType::HTTP1); config_helper_.configureUpstreamTls(); initialize(); IntegrationTcpClientPtr tcp_client = makeTcpConnection(lookupPort("tcp_proxy")); @@ -1469,7 +1469,7 @@ TEST_P(MysqlIntegrationTest, Preconnect) { testPreconnect(); } TEST_P(MysqlIntegrationTest, PreconnectWithTls) { upstream_tls_ = true; - setUpstreamProtocol(FakeHttpConnection::Type::HTTP1); + setUpstreamProtocol(Http::CodecType::HTTP1); config_helper_.configureUpstreamTls(); testPreconnect(); } diff --git a/test/integration/tcp_tunneling_integration_test.cc b/test/integration/tcp_tunneling_integration_test.cc index 42d70385524ef..c6aae7bef4ba0 100644 --- a/test/integration/tcp_tunneling_integration_test.cc +++ b/test/integration/tcp_tunneling_integration_test.cc @@ -16,8 +16,7 @@ class ConnectTerminationIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - ConnectTerminationIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) { + ConnectTerminationIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) { enableHalfClose(true); } @@ -226,7 +225,7 @@ TEST_P(ConnectTerminationIntegrationTest, BasicMaxStreamDuration) { test_server_->waitForCounterGe("cluster.cluster_0.upstream_rq_max_duration_reached", 1); - if (downstream_protocol_ == Http::CodecClient::Type::HTTP1) { + if (downstream_protocol_ == Http::CodecType::HTTP1) { ASSERT_TRUE(codec_client_->waitForDisconnect()); } else { ASSERT_TRUE(response_->waitForReset()); @@ -274,7 +273,7 @@ TEST_P(ProxyingConnectIntegrationTest, 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() == FakeHttpConnection::Type::HTTP1) { + 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(), @@ -322,7 +321,7 @@ TEST_P(ProxyingConnectIntegrationTest, ProxyConnectWithPortStrippingLegacy) { ASSERT_TRUE(upstream_request_->waitForHeadersComplete()); EXPECT_EQ(upstream_request_->headers().getMethodValue(), "CONNECT"); EXPECT_EQ(upstream_request_->headers().getHostValue(), "host:80"); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + 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(), @@ -376,7 +375,7 @@ TEST_P(ProxyingConnectIntegrationTest, ProxyConnectWithPortStripping) { ASSERT_TRUE(upstream_request_->waitForHeadersComplete()); EXPECT_EQ(upstream_request_->headers().getMethodValue(), "CONNECT"); EXPECT_EQ(upstream_request_->headers().getHostValue(), "host:80"); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { EXPECT_TRUE(upstream_request_->headers().getProtocolValue().empty()); } else { EXPECT_EQ(upstream_request_->headers().getProtocolValue(), "bytestream"); @@ -421,7 +420,7 @@ TEST_P(ProxyingConnectIntegrationTest, ProxyConnectWithIP) { 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() == FakeHttpConnection::Type::HTTP1) { + 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(), @@ -442,26 +441,26 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, ConnectTerminationIntegrationTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); -using Params = std::tuple; +using Params = std::tuple; // Tunneling downstream TCP over an upstream HTTP CONNECT tunnel. class TcpTunnelingIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: TcpTunnelingIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, std::get<0>(GetParam())) {} + : HttpIntegrationTest(Http::CodecType::HTTP2, std::get<0>(GetParam())) {} static std::string paramsToString(const testing::TestParamInfo& p) { return fmt::format( "{}_{}_{}", std::get<0>(p.param) == Network::Address::IpVersion::v4 ? "IPv4" : "IPv6", - std::get<1>(p.param) == FakeHttpConnection::Type::HTTP1 ? "HTTP1Upstream" : "HTTP2Upstream", + std::get<1>(p.param) == Http::CodecType::HTTP1 ? "HTTP1Upstream" : "HTTP2Upstream", std::get<2>(p.param) ? "WaitConnectResponse" : "DoNotWaitConnectResponse"); } void SetUp() override { wait_for_connect_response_ = std::get<2>(GetParam()); enableHalfClose(true); - setDownstreamProtocol(Http::CodecClient::Type::HTTP2); + setDownstreamProtocol(Http::CodecType::HTTP2); setUpstreamProtocol(std::get<1>(GetParam())); if (wait_for_connect_response_) { @@ -519,7 +518,7 @@ TEST_P(TcpTunnelingIntegrationTest, Basic) { ASSERT_TRUE(tcp_client->write("hello", false)); tcp_client->close(); ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, 5)); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForEndStream(*dispatcher_)); @@ -574,7 +573,7 @@ TEST_P(TcpTunnelingIntegrationTest, BasicUsePost) { ASSERT_TRUE(tcp_client->write("hello", false)); tcp_client->close(); ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, 5)); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForEndStream(*dispatcher_)); @@ -596,7 +595,7 @@ TEST_P(TcpTunnelingIntegrationTest, InvalidResponseHeaders) { // upstream gets a stream reset. default_response_headers_.setStatus(enumToInt(Http::Code::ServiceUnavailable)); upstream_request_->encodeHeaders(default_response_headers_, false); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -625,13 +624,13 @@ TEST_P(TcpTunnelingIntegrationTest, CloseUpstreamFirst) { // Send data from upstream to downstream with an end stream and make sure the data is received // before the connection is half-closed. upstream_request_->encodeData(12, true); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->close()); } ASSERT_TRUE(tcp_client->waitForData(12)); tcp_client->waitForHalfClose(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); tcp_client->close(); } else { @@ -647,7 +646,7 @@ TEST_P(TcpTunnelingIntegrationTest, CloseUpstreamFirst) { } TEST_P(TcpTunnelingIntegrationTest, ResetStreamTest) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { return; } enableHalfClose(false); @@ -696,7 +695,7 @@ TEST_P(TcpTunnelingIntegrationTest, TestIdletimeoutWithLargeOutstandingData) { upstream_request_->encodeData(data, false); tcp_client->waitForDisconnect(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); tcp_client->close(); } else { @@ -719,7 +718,7 @@ TEST_P(TcpTunnelingIntegrationTest, TcpProxyDownstreamFlush) { upstream_request_->encodeHeaders(default_response_headers_, false); tcp_client->readDisable(true); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(tcp_client->write("hello", false)); ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, 5)); @@ -739,7 +738,7 @@ TEST_P(TcpTunnelingIntegrationTest, TcpProxyDownstreamFlush) { tcp_client->readDisable(false); tcp_client->waitForData(data); tcp_client->waitForHalfClose(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { tcp_client->close(); } } @@ -765,7 +764,7 @@ TEST_P(TcpTunnelingIntegrationTest, TcpProxyUpstreamFlush) { ASSERT_TRUE(tcp_client->waitForData(5)); ASSERT_TRUE(tcp_client->write(data, true)); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { tcp_client->close(); upstream_request_->readDisable(false); @@ -785,7 +784,7 @@ TEST_P(TcpTunnelingIntegrationTest, TcpProxyUpstreamFlush) { // Test that h2 connection is reused. TEST_P(TcpTunnelingIntegrationTest, H2ConnectionReuse) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { return; } initialize(); @@ -831,7 +830,7 @@ TEST_P(TcpTunnelingIntegrationTest, H2ConnectionReuse) { // Test that with HTTP1 we have no connection reuse with downstream close. TEST_P(TcpTunnelingIntegrationTest, H1NoConnectionReuse) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() == Http::CodecType::HTTP2) { return; } initialize(); @@ -872,7 +871,7 @@ TEST_P(TcpTunnelingIntegrationTest, H1NoConnectionReuse) { // Test that with HTTP1 we have no connection with upstream close. TEST_P(TcpTunnelingIntegrationTest, H1UpstreamCloseNoConnectionReuse) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() == Http::CodecType::HTTP2) { return; } initialize(); @@ -916,7 +915,7 @@ TEST_P(TcpTunnelingIntegrationTest, H1UpstreamCloseNoConnectionReuse) { } TEST_P(TcpTunnelingIntegrationTest, 2xxStatusCodeValidHttp1) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() == Http::CodecType::HTTP2) { return; } initialize(); @@ -946,7 +945,7 @@ TEST_P(TcpTunnelingIntegrationTest, 2xxStatusCodeValidHttp1) { } TEST_P(TcpTunnelingIntegrationTest, ContentLengthHeaderIgnoredHttp1) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() == Http::CodecType::HTTP2) { return; } initialize(); @@ -975,7 +974,7 @@ TEST_P(TcpTunnelingIntegrationTest, ContentLengthHeaderIgnoredHttp1) { } TEST_P(TcpTunnelingIntegrationTest, TransferEncodingHeaderIgnoredHttp1) { - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (upstreamProtocol() == Http::CodecType::HTTP2) { return; } initialize(); @@ -1029,7 +1028,7 @@ TEST_P(TcpTunnelingIntegrationTest, DeferTransmitDataUntilSuccessConnectResponse ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, 5)); tcp_client->close(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForEndStream(*dispatcher_)); @@ -1061,7 +1060,7 @@ TEST_P(TcpTunnelingIntegrationTest, NoDataTransmittedIfConnectFailureResponseIsR ASSERT_FALSE(upstream_request_->waitForData(*dispatcher_, 1, std::chrono::milliseconds(100))); tcp_client->close(); - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(fake_upstream_connection_->waitForDisconnect()); } else { ASSERT_TRUE(upstream_request_->waitForReset()); @@ -1086,8 +1085,7 @@ TEST_P(TcpTunnelingIntegrationTest, UpstreamDisconnectBeforeResponseReceived) { INSTANTIATE_TEST_SUITE_P( IpAndHttpVersions, TcpTunnelingIntegrationTest, ::testing::Combine(testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), - testing::Values(FakeHttpConnection::Type::HTTP1, - FakeHttpConnection::Type::HTTP2), + testing::Values(Http::CodecType::HTTP1, Http::CodecType::HTTP2), testing::Values(false, true)), TcpTunnelingIntegrationTest::paramsToString); diff --git a/test/integration/transport_socket_match_integration_test.cc b/test/integration/transport_socket_match_integration_test.cc index 1bc92bae21f8d..fe5fe47026df6 100644 --- a/test/integration/transport_socket_match_integration_test.cc +++ b/test/integration/transport_socket_match_integration_test.cc @@ -13,8 +13,7 @@ namespace Envoy { class TransportSockeMatchIntegrationTest : public testing::Test, public HttpIntegrationTest { public: TransportSockeMatchIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, - TestEnvironment::getIpVersionsForTest().front(), + : HttpIntegrationTest(Http::CodecType::HTTP1, TestEnvironment::getIpVersionsForTest().front(), ConfigHelper::httpProxyConfig()) { autonomous_upstream_ = true; setUpstreamCount(num_hosts_); @@ -130,8 +129,8 @@ name: "tls_socket" } void SetUp() override { - setDownstreamProtocol(Http::CodecClient::Type::HTTP1); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP1); + setDownstreamProtocol(Http::CodecType::HTTP1); + setUpstreamProtocol(Http::CodecType::HTTP1); } const uint32_t num_hosts_{2}; diff --git a/test/integration/uds_integration_test.h b/test/integration/uds_integration_test.h index 8d5675e168053..f2961b62eb141 100644 --- a/test/integration/uds_integration_test.h +++ b/test/integration/uds_integration_test.h @@ -21,12 +21,12 @@ class UdsUpstreamIntegrationTest public HttpIntegrationTest { public: UdsUpstreamIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, std::get<0>(GetParam())), + : HttpIntegrationTest(Http::CodecType::HTTP1, std::get<0>(GetParam())), abstract_namespace_(std::get<1>(GetParam())) {} void createUpstreams() override { FakeUpstreamConfig config = upstreamConfig(); - config.upstream_protocol_ = FakeHttpConnection::Type::HTTP1; + config.upstream_protocol_ = Http::CodecType::HTTP1; auto uds_path = TestEnvironment::unixDomainSocketPath("udstest.1.sock", abstract_namespace_); fake_upstreams_.emplace_back(std::make_unique(uds_path, config)); @@ -60,7 +60,7 @@ class UdsListenerIntegrationTest public HttpIntegrationTest { public: UdsListenerIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, std::get<0>(GetParam())), + : HttpIntegrationTest(Http::CodecType::HTTP1, std::get<0>(GetParam())), abstract_namespace_(std::get<1>(GetParam())), mode_(std::get<2>(GetParam())) {} void initialize() override; diff --git a/test/integration/utility.cc b/test/integration/utility.cc index 7d99f7e4dcc8b..4568a8f209706 100644 --- a/test/integration/utility.cc +++ b/test/integration/utility.cc @@ -179,7 +179,7 @@ sendRequestAndWaitForResponse(Event::Dispatcher& dispatcher, const std::string& BufferingStreamDecoderPtr IntegrationUtil::makeSingleRequest(const Network::Address::InstanceConstSharedPtr& addr, const std::string& method, const std::string& url, - const std::string& body, Http::CodecClient::Type type, + const std::string& body, Http::CodecType type, const std::string& host, const std::string& content_type) { NiceMock mock_stats_store; NiceMock random; @@ -191,11 +191,10 @@ IntegrationUtil::makeSingleRequest(const Network::Address::InstanceConstSharedPt TestConnectionCallbacks connection_callbacks(*dispatcher); std::shared_ptr cluster{new NiceMock()}; Upstream::HostDescriptionConstSharedPtr host_description{Upstream::makeTestHostDescription( - cluster, - fmt::format("{}://127.0.0.1:80", (type == Http::CodecClient::Type::HTTP3 ? "udp" : "tcp")), + cluster, fmt::format("{}://127.0.0.1:80", (type == Http::CodecType::HTTP3 ? "udp" : "tcp")), time_system)}; - if (type <= Http::CodecClient::Type::HTTP2) { + if (type <= Http::CodecType::HTTP2) { Http::CodecClientProd client( type, dispatcher->createClientConnection(addr, Network::Address::InstanceConstSharedPtr(), @@ -236,7 +235,7 @@ IntegrationUtil::makeSingleRequest(const Network::Address::InstanceConstSharedPt BufferingStreamDecoderPtr IntegrationUtil::makeSingleRequest(uint32_t port, const std::string& method, const std::string& url, - const std::string& body, Http::CodecClient::Type type, + const std::string& body, Http::CodecType type, Network::Address::IpVersion ip_version, const std::string& host, const std::string& content_type) { auto addr = Network::Utility::resolveUrl( diff --git a/test/integration/utility.h b/test/integration/utility.h index 2deaf89203701..6fb283dcb1a0e 100644 --- a/test/integration/utility.h +++ b/test/integration/utility.h @@ -168,7 +168,7 @@ class IntegrationUtil { */ static BufferingStreamDecoderPtr makeSingleRequest(const Network::Address::InstanceConstSharedPtr& addr, const std::string& method, - const std::string& url, const std::string& body, Http::CodecClient::Type type, + const std::string& url, const std::string& body, Http::CodecType type, const std::string& host = "host", const std::string& content_type = ""); /** @@ -184,11 +184,12 @@ class IntegrationUtil { * @return BufferingStreamDecoderPtr the complete request or a partial request if there was * remote early disconnection. */ - static BufferingStreamDecoderPtr - makeSingleRequest(uint32_t port, const std::string& method, const std::string& url, - const std::string& body, Http::CodecClient::Type type, - Network::Address::IpVersion ip_version, const std::string& host = "host", - const std::string& content_type = ""); + static BufferingStreamDecoderPtr makeSingleRequest(uint32_t port, const std::string& method, + const std::string& url, + const std::string& body, Http::CodecType type, + Network::Address::IpVersion ip_version, + const std::string& host = "host", + const std::string& content_type = ""); /** * Create transport socket factory for Quic upstream transport socket. diff --git a/test/integration/version_integration_test.cc b/test/integration/version_integration_test.cc index 4888f5c7ceefb..67b376a83e527 100644 --- a/test/integration/version_integration_test.cc +++ b/test/integration/version_integration_test.cc @@ -9,7 +9,7 @@ namespace { class VersionIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - VersionIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + VersionIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} }; INSTANTIATE_TEST_SUITE_P(IpVersions, VersionIntegrationTest, diff --git a/test/integration/vhds_integration_test.cc b/test/integration/vhds_integration_test.cc index f310ded250f42..d2798fe6e2fdc 100644 --- a/test/integration/vhds_integration_test.cc +++ b/test/integration/vhds_integration_test.cc @@ -155,8 +155,7 @@ domains: [{}] class VhdsInitializationTest : public HttpIntegrationTest, public Grpc::GrpcClientIntegrationParamTest { public: - VhdsInitializationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), config()) { + VhdsInitializationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), config()) { use_lds_ = false; } @@ -169,8 +168,8 @@ class VhdsInitializationTest : public HttpIntegrationTest, // BaseIntegrationTest::createUpstreams() (which is part of initialize()). // Make sure this number matches the size of the 'clusters' repeated field in the bootstrap // config that you use! - setUpstreamCount(2); // the CDS cluster - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); // CDS uses gRPC uses HTTP2. + setUpstreamCount(2); // the CDS cluster + setUpstreamProtocol(Http::CodecType::HTTP2); // CDS uses gRPC uses HTTP2. // BaseIntegrationTest::initialize() does many things: // 1) It appends to fake_upstreams_ as many as you asked for via setUpstreamCount(). @@ -252,8 +251,7 @@ TEST_P(VhdsInitializationTest, InitializeVhdsAfterRdsHasBeenInitialized) { class VhdsIntegrationTest : public HttpIntegrationTest, public Grpc::GrpcClientIntegrationParamTest { public: - VhdsIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, ipVersion(), config()) { + VhdsIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, ipVersion(), config()) { use_lds_ = false; } @@ -291,8 +289,8 @@ class VhdsIntegrationTest : public HttpIntegrationTest, // BaseIntegrationTest::createUpstreams() (which is part of initialize()). // Make sure this number matches the size of the 'clusters' repeated field in the bootstrap // config that you use! - setUpstreamCount(2); // the CDS cluster - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); // CDS uses gRPC uses HTTP2. + setUpstreamCount(2); // the CDS cluster + setUpstreamProtocol(Http::CodecType::HTTP2); // CDS uses gRPC uses HTTP2. // BaseIntegrationTest::initialize() does many things: // 1) It appends to fake_upstreams_ as many as you asked for via setUpstreamCount(). diff --git a/test/integration/websocket_integration_test.cc b/test/integration/websocket_integration_test.cc index ef6cab3ed57ce..bf96e27d49683 100644 --- a/test/integration/websocket_integration_test.cc +++ b/test/integration/websocket_integration_test.cc @@ -117,7 +117,7 @@ ConfigHelper::HttpModifierFunction setRouteUsingWebsocket() { } void WebsocketIntegrationTest::initialize() { - if (upstreamProtocol() != FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() != Http::CodecType::HTTP1) { config_helper_.addConfigModifier( [&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void { ConfigHelper::HttpProtocolOptions protocol_options; @@ -128,7 +128,7 @@ void WebsocketIntegrationTest::initialize() { *bootstrap.mutable_static_resources()->mutable_clusters(0), protocol_options); }); } - if (downstreamProtocol() != Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() != Http::CodecType::HTTP1) { config_helper_.addConfigModifier( [&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& hcm) -> void { hcm.mutable_http2_protocol_options()->set_allow_connect(true); }); @@ -195,7 +195,7 @@ TEST_P(WebsocketIntegrationTest, WebSocketConnectionDownstreamDisconnect) { } TEST_P(WebsocketIntegrationTest, PortStrippingForHttp2) { - if (downstreamProtocol() != Http::CodecClient::Type::HTTP2) { + if (downstreamProtocol() != Http::CodecType::HTTP2) { return; } @@ -217,8 +217,8 @@ TEST_P(WebsocketIntegrationTest, PortStrippingForHttp2) { } TEST_P(WebsocketIntegrationTest, EarlyData) { - if (downstreamProtocol() == Http::CodecClient::Type::HTTP2 || - upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (downstreamProtocol() == Http::CodecType::HTTP2 || + upstreamProtocol() == Http::CodecType::HTTP2) { return; } config_helper_.addConfigModifier(setRouteUsingWebsocket()); @@ -255,7 +255,7 @@ TEST_P(WebsocketIntegrationTest, EarlyData) { auto upgrade_response_headers(upgradeResponseHeaders()); validateUpgradeResponseHeaders(response_->headers(), upgrade_response_headers); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { // For H2, the disconnect may result in the terminal data not being proxied. response_->waitForBodyData(5); } @@ -301,7 +301,7 @@ TEST_P(WebsocketIntegrationTest, NonWebsocketUpgrade) { performUpgrade(upgradeRequestHeaders("foo", 0), upgradeResponseHeaders("foo")); sendBidirectionalData(); codec_client_->sendData(*request_encoder_, "bye!", false); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { codec_client_->close(); } else { codec_client_->sendReset(*request_encoder_); @@ -331,7 +331,7 @@ TEST_P(WebsocketIntegrationTest, RouteSpecificUpgrade) { performUpgrade(upgradeRequestHeaders("foo", 0), upgradeResponseHeaders("foo")); sendBidirectionalData(); codec_client_->sendData(*request_encoder_, "bye!", false); - if (downstreamProtocol() == Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() == Http::CodecType::HTTP1) { codec_client_->close(); } else { codec_client_->sendReset(*request_encoder_); @@ -395,7 +395,7 @@ TEST_P(WebsocketIntegrationTest, WebsocketCustomFilterChain) { // Foo upgrades are configured without the buffer filter, so should explicitly // allow large payload. - if (downstreamProtocol() != Http::CodecClient::Type::HTTP2) { + if (downstreamProtocol() != Http::CodecType::HTTP2) { performUpgrade(upgradeRequestHeaders("foo"), upgradeResponseHeaders("foo")); codec_client_->sendData(*request_encoder_, large_req_str, false); ASSERT_TRUE(upstream_request_->waitForData(*dispatcher_, large_req_str)); @@ -407,8 +407,8 @@ TEST_P(WebsocketIntegrationTest, WebsocketCustomFilterChain) { } TEST_P(WebsocketIntegrationTest, BidirectionalChunkedData) { - if (downstreamProtocol() == Http::CodecClient::Type::HTTP2 || - upstreamProtocol() == FakeHttpConnection::Type::HTTP2) { + if (downstreamProtocol() == Http::CodecType::HTTP2 || + upstreamProtocol() == Http::CodecType::HTTP2) { return; } @@ -423,7 +423,7 @@ TEST_P(WebsocketIntegrationTest, BidirectionalChunkedData) { // With content-length not present, the HTTP codec will send the request with // transfer-encoding: chunked. - if (upstreamProtocol() == FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() == Http::CodecType::HTTP1) { ASSERT_TRUE(upstream_request_->headers().TransferEncoding() != nullptr); } diff --git a/test/integration/websocket_integration_test.h b/test/integration/websocket_integration_test.h index 1f3aa362ebf20..4e03ca44bd87a 100644 --- a/test/integration/websocket_integration_test.h +++ b/test/integration/websocket_integration_test.h @@ -10,8 +10,8 @@ namespace Envoy { struct WebsocketProtocolTestParams { Network::Address::IpVersion version; - Http::CodecClient::Type downstream_protocol; - FakeHttpConnection::Type upstream_protocol; + Http::CodecType downstream_protocol; + Http::CodecType upstream_protocol; }; class WebsocketIntegrationTest : public HttpProtocolIntegrationTest { @@ -30,7 +30,7 @@ class WebsocketIntegrationTest : public HttpProtocolIntegrationTest { ABSL_MUST_USE_RESULT testing::AssertionResult waitForUpstreamDisconnectOrReset() { - if (upstreamProtocol() != FakeHttpConnection::Type::HTTP1) { + if (upstreamProtocol() != Http::CodecType::HTTP1) { return upstream_request_->waitForReset(); } else { return fake_upstream_connection_->waitForDisconnect(); @@ -39,7 +39,7 @@ class WebsocketIntegrationTest : public HttpProtocolIntegrationTest { void waitForClientDisconnectOrReset( Http::StreamResetReason reason = Http::StreamResetReason::RemoteReset) { - if (downstreamProtocol() != Http::CodecClient::Type::HTTP1) { + if (downstreamProtocol() != Http::CodecType::HTTP1) { ASSERT_TRUE(response_->waitForReset()); ASSERT_EQ(reason, response_->resetReason()); } else { diff --git a/test/integration/xds_integration_test.cc b/test/integration/xds_integration_test.cc index c5d3167719665..c4dd65445a156 100644 --- a/test/integration/xds_integration_test.cc +++ b/test/integration/xds_integration_test.cc @@ -21,8 +21,8 @@ using testing::HasSubstr; class XdsIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - XdsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam()) { - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + XdsIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP2, GetParam()) { + setUpstreamProtocol(Http::CodecType::HTTP2); } void createEnvoy() override { @@ -291,8 +291,7 @@ class LdsInplaceUpdateHttpIntegrationTest : public testing::TestWithParam, public HttpIntegrationTest { public: - LdsInplaceUpdateHttpIntegrationTest() - : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} + LdsInplaceUpdateHttpIntegrationTest() : HttpIntegrationTest(Http::CodecType::HTTP1, GetParam()) {} void inplaceInitialize(bool add_default_filter_chain = false) { autonomous_upstream_ = true; @@ -533,7 +532,7 @@ using LdsIntegrationTest = HttpProtocolIntegrationTest; INSTANTIATE_TEST_SUITE_P(Protocols, LdsIntegrationTest, testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams( - {Http::CodecClient::Type::HTTP1}, {FakeHttpConnection::Type::HTTP1})), + {Http::CodecType::HTTP1}, {Http::CodecType::HTTP1})), HttpProtocolIntegrationTest::protocolTestParamsToString); // Sample test making sure our config framework correctly reloads listeners. diff --git a/test/integration/xfcc_integration_test.cc b/test/integration/xfcc_integration_test.cc index 0df12253e728c..820fb494bea60 100644 --- a/test/integration/xfcc_integration_test.cc +++ b/test/integration/xfcc_integration_test.cc @@ -118,7 +118,7 @@ Network::ClientConnectionPtr XfccIntegrationTest::makeMtlsClientConnection() { } void XfccIntegrationTest::createUpstreams() { - addFakeUpstream(createUpstreamSslContext(), FakeHttpConnection::Type::HTTP1); + addFakeUpstream(createUpstreamSslContext(), Http::CodecType::HTTP1); } void XfccIntegrationTest::initialize() { diff --git a/test/integration/xfcc_integration_test.h b/test/integration/xfcc_integration_test.h index 6e4997f8b0dc8..1057051b5685f 100644 --- a/test/integration/xfcc_integration_test.h +++ b/test/integration/xfcc_integration_test.h @@ -37,7 +37,7 @@ class XfccIntegrationTest : public testing::TestWithParamMergeFrom(bootstrap.static_resources().clusters()[0]); ads_cluster->set_name("ads_cluster"); }); - setUpstreamProtocol(FakeHttpConnection::Type::HTTP2); + setUpstreamProtocol(Http::CodecType::HTTP2); HttpIntegrationTest::initialize(); if (xds_stream_ == nullptr) { createXdsConnection(); From 7645259a7aa6389aaa222b6c9fe19c599c70f03d Mon Sep 17 00:00:00 2001 From: Alyssa Wilk Date: Mon, 24 May 2021 11:03:02 -0400 Subject: [PATCH 2/2] comment Signed-off-by: Alyssa Wilk --- test/integration/fake_upstream.h | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration/fake_upstream.h b/test/integration/fake_upstream.h index 5d7660bd3252e..3ec327dcb2aa8 100644 --- a/test/integration/fake_upstream.h +++ b/test/integration/fake_upstream.h @@ -415,7 +415,6 @@ class FakeHttpConnection : public Http::ServerConnectionCallbacks, public FakeCo public: // This is a legacy alias. using Type = Envoy::Http::CodecType; - // using Type = Envoy::Http::CodecType; static absl::string_view typeToString(Http::CodecType type) { switch (type) { case Http::CodecType::HTTP1: