From 68bf5729296ee38b94b3f963bd7cca48735797db Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Thu, 9 Sep 2021 18:19:35 -0400 Subject: [PATCH 1/7] tests: rename addFilter() to prependFilter() To avoid confusion when writing integration tests, make it clear that filters are prepended. Signed-off-by: Raul Gutierrez Segales --- test/config/utility.h | 10 +- ...tive_concurrency_filter_integration_test.h | 2 +- .../admission_control_integration_test.cc | 2 +- .../filter_integration_test.cc | 2 +- .../aws_lambda_filter_integration_test.cc | 2 +- .../buffer/buffer_filter_integration_test.cc | 20 ++-- .../cache/cache_filter_integration_test.cc | 2 +- .../http/cdn_loop/filter_integration_test.cc | 16 +-- .../composite_filter_integration_test.cc | 2 +- .../compressor_filter_integration_test.cc | 2 +- .../compressor_integration_tests.cc | 4 +- .../http/cors/cors_filter_integration_test.cc | 2 +- .../http/csrf/csrf_filter_integration_test.cc | 22 ++-- .../decompressor_filter_integration_test.cc | 2 +- .../proxy_filter_integration_test.cc | 2 +- .../ext_authz/ext_authz_integration_test.cc | 6 +- .../http/ext_proc/ext_proc_grpc_fuzz.cc | 2 +- .../ext_proc/ext_proc_integration_test.cc | 2 +- .../ext_proc/streaming_integration_test.cc | 2 +- .../fault/fault_filter_integration_test.cc | 2 +- .../reverse_bridge_integration_test.cc | 2 +- .../grpc_json_transcoder_integration_test.cc | 20 ++-- .../grpc_web_filter_integration_test.cc | 2 +- .../http/jwt_authn/filter_integration_test.cc | 22 ++-- .../kill_request/crash_integration_test.cc | 18 +-- .../kill_request_filter_integration_test.cc | 2 +- .../local_ratelimit_integration_test.cc | 2 +- .../filters/http/lua/lua_integration_test.cc | 6 +- .../http/oauth2/oauth_integration_test.cc | 2 +- .../ratelimit/ratelimit_integration_test.cc | 2 +- .../http/rbac/rbac_filter_integration_test.cc | 30 ++--- .../http/tap/tap_filter_integration_test.cc | 2 +- ...reserve_case_formatter_integration_test.cc | 2 +- .../alts/alts_integration_test.cc | 2 +- test/integration/README.md | 2 +- .../drain_close_integration_test.cc | 4 +- test/integration/eds_integration_test.cc | 2 +- .../http2_flood_integration_test.cc | 2 +- test/integration/http_integration.cc | 4 +- .../idle_timeout_integration_test.cc | 4 +- test/integration/integration_admin_test.cc | 2 +- test/integration/integration_admin_test.h | 2 +- test/integration/integration_test.cc | 32 +++--- .../multiplexed_integration_test.cc | 10 +- .../multiplexed_integration_test.h | 2 +- .../multiplexed_upstream_integration_test.cc | 6 +- test/integration/protocol_integration_test.cc | 108 +++++++++--------- test/integration/redirect_integration_test.cc | 2 +- .../scoped_rds_integration_test.cc | 12 +- .../sds_generic_secret_integration_test.cc | 2 +- test/integration/version_integration_test.cc | 8 +- .../integration/websocket_integration_test.cc | 2 +- 52 files changed, 212 insertions(+), 214 deletions(-) diff --git a/test/config/utility.h b/test/config/utility.h index 06865cc36518a..2fa8ee4b516d5 100644 --- a/test/config/utility.h +++ b/test/config/utility.h @@ -127,13 +127,13 @@ class ConfigHelper { static std::string httpProxyConfig(bool downstream_use_quic = false); // A basic configuration for L7 proxying with QUIC transport. static std::string quicHttpProxyConfig(); - // A string for a basic buffer filter, which can be used with addFilter() + // A string for a basic buffer filter, which can be used with prependFilter() static std::string defaultBufferFilter(); - // A string for a small buffer filter, which can be used with addFilter() + // A string for a small buffer filter, which can be used with prependFilter() static std::string smallBufferFilter(); - // A string for a health check filter which can be used with addFilter() + // A string for a health check filter which can be used with prependFilter() static std::string defaultHealthCheckFilter(); - // A string for a squash filter which can be used with addFilter() + // A string for a squash filter which can be used with prependFilter() static std::string defaultSquashFilter(); // A string for startTls transport socket config. static std::string startTlsConfig(); @@ -213,7 +213,7 @@ class ConfigHelper { void addVirtualHost(const envoy::config::route::v3::VirtualHost& vhost); // Add an HTTP filter prior to existing filters. - void addFilter(const std::string& filter_yaml); + void prependFilter(const std::string& filter_yaml); // Add a network filter prior to existing filters. void addNetworkFilter(const std::string& filter_yaml); 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 35a107450298e..022ad5a114bb1 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 @@ -41,7 +41,7 @@ class AdaptiveConcurrencyIntegrationTest void customInit() { setDownstreamProtocol(Http::CodecType::HTTP2); setUpstreamProtocol(Http::CodecType::HTTP2); - config_helper_.addFilter(ADAPTIVE_CONCURRENCY_CONFIG); + config_helper_.prependFilter(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 8fb07712f747b..e59dba7611f65 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 @@ -46,7 +46,7 @@ class AdmissionControlIntegrationTest : public Event::TestUsingSimulatedTime, void initialize() override { config_helper_.addConfigModifier(setEnableDownstreamTrailersHttp1()); - config_helper_.addFilter(ADMISSION_CONTROL_CONFIG); + config_helper_.prependFilter(ADMISSION_CONTROL_CONFIG); HttpIntegrationTest::initialize(); } diff --git a/test/extensions/filters/http/alternate_protocols_cache/filter_integration_test.cc b/test/extensions/filters/http/alternate_protocols_cache/filter_integration_test.cc index 74660d6a2c6b2..0bfc84ac19fae 100644 --- a/test/extensions/filters/http/alternate_protocols_cache/filter_integration_test.cc +++ b/test/extensions/filters/http/alternate_protocols_cache/filter_integration_test.cc @@ -25,7 +25,7 @@ name: alternate_protocols_cache alternate_protocols_cache_options: name: default_alternate_protocols_cache )EOF"; - config_helper_.addFilter(filter); + config_helper_.prependFilter(filter); upstream_tls_ = true; config_helper_.configureUpstreamTls(/*use_alpn=*/true, /*http3=*/true, 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 db3227d9a2df4..ce86d677eb696 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 @@ -37,7 +37,7 @@ class AwsLambdaFilterIntegrationTest : public testing::TestWithParamset_seconds(2000 * 1000); }); - config_helper_.addFilter(ConfigHelper::smallBufferFilter()); + config_helper_.prependFilter(ConfigHelper::smallBufferFilter()); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -142,7 +142,7 @@ ConfigHelper::HttpModifierFunction overrideConfig(const std::string& json_config TEST_P(BufferIntegrationTest, RouteDisabled) { ConfigHelper::HttpModifierFunction mod = overrideConfig(R"EOF({"disabled": true})EOF"); config_helper_.addConfigModifier(mod); - config_helper_.addFilter(ConfigHelper::smallBufferFilter()); + config_helper_.prependFilter(ConfigHelper::smallBufferFilter()); config_helper_.setBufferLimits(1024, 1024); initialize(); @@ -169,7 +169,7 @@ TEST_P(BufferIntegrationTest, RouteOverride) { "max_request_bytes": 5242880 }})EOF"); config_helper_.addConfigModifier(mod); - config_helper_.addFilter(ConfigHelper::smallBufferFilter()); + config_helper_.prependFilter(ConfigHelper::smallBufferFilter()); initialize(); diff --git a/test/extensions/filters/http/cache/cache_filter_integration_test.cc b/test/extensions/filters/http/cache/cache_filter_integration_test.cc index d275df8cc48f3..5f09027b73900 100644 --- a/test/extensions/filters/http/cache/cache_filter_integration_test.cc +++ b/test/extensions/filters/http/cache/cache_filter_integration_test.cc @@ -33,7 +33,7 @@ class CacheIntegrationTest : public Event::TestUsingSimulatedTime, } void initializeFilter(const std::string& config) { - config_helper_.addFilter(config); + config_helper_.prependFilter(config); initialize(); codec_client_ = makeHttpConnection(makeClientConnection((lookupPort("http")))); } 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 5e61749d0bf28..1403d84aa5adc 100644 --- a/test/extensions/filters/http/cdn_loop/filter_integration_test.cc +++ b/test/extensions/filters/http/cdn_loop/filter_integration_test.cc @@ -31,7 +31,7 @@ name: envoy.filters.http.cdn_loop class CdnLoopFilterIntegrationTest : public HttpProtocolIntegrationTest {}; TEST_P(CdnLoopFilterIntegrationTest, NoCdnLoopHeader) { - config_helper_.addFilter(MaxDefaultConfig); + config_helper_.prependFilter(MaxDefaultConfig); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -48,7 +48,7 @@ TEST_P(CdnLoopFilterIntegrationTest, NoCdnLoopHeader) { } TEST_P(CdnLoopFilterIntegrationTest, CdnLoopHeaderWithOtherCdns) { - config_helper_.addFilter(MaxDefaultConfig); + config_helper_.prependFilter(MaxDefaultConfig); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -68,7 +68,7 @@ TEST_P(CdnLoopFilterIntegrationTest, CdnLoopHeaderWithOtherCdns) { } TEST_P(CdnLoopFilterIntegrationTest, MultipleCdnLoopHeaders) { - config_helper_.addFilter(MaxDefaultConfig); + config_helper_.prependFilter(MaxDefaultConfig); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -86,7 +86,7 @@ TEST_P(CdnLoopFilterIntegrationTest, MultipleCdnLoopHeaders) { } TEST_P(CdnLoopFilterIntegrationTest, CdnLoop0Allowed1Seen) { - config_helper_.addFilter(MaxDefaultConfig); + config_helper_.prependFilter(MaxDefaultConfig); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -103,7 +103,7 @@ TEST_P(CdnLoopFilterIntegrationTest, CdnLoop0Allowed1Seen) { } TEST_P(CdnLoopFilterIntegrationTest, UnparseableHeader) { - config_helper_.addFilter(MaxDefaultConfig); + config_helper_.prependFilter(MaxDefaultConfig); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -120,7 +120,7 @@ TEST_P(CdnLoopFilterIntegrationTest, UnparseableHeader) { } TEST_P(CdnLoopFilterIntegrationTest, CdnLoop2Allowed1Seen) { - config_helper_.addFilter(MaxOf2Config); + config_helper_.prependFilter(MaxOf2Config); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -140,7 +140,7 @@ TEST_P(CdnLoopFilterIntegrationTest, CdnLoop2Allowed1Seen) { } TEST_P(CdnLoopFilterIntegrationTest, CdnLoop2Allowed2Seen) { - config_helper_.addFilter(MaxOf2Config); + config_helper_.prependFilter(MaxOf2Config); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); @@ -160,7 +160,7 @@ TEST_P(CdnLoopFilterIntegrationTest, CdnLoop2Allowed2Seen) { } TEST_P(CdnLoopFilterIntegrationTest, CdnLoop2Allowed3Seen) { - config_helper_.addFilter(MaxOf2Config); + config_helper_.prependFilter(MaxOf2Config); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); 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 cd7ffec42e28d..551112736898c 100644 --- a/test/extensions/filters/http/composite/composite_filter_integration_test.cc +++ b/test/extensions/filters/http/composite/composite_filter_integration_test.cc @@ -16,7 +16,7 @@ class CompositeFilterIntegrationTest : public testing::TestWithParam void { hcm.mutable_http2_protocol_options()->set_allow_connect(true); }); } - config_helper_.addFilter(compressorFilterConfig); + config_helper_.prependFilter(compressorFilterConfig); HttpProtocolIntegrationTest::initialize(); } @@ -247,7 +247,7 @@ void CompressorProxyingConnectIntegrationTest::initialize() { config_helper_.addConfigModifier( [&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& hcm) -> void { ConfigHelper::setConnectConfig(hcm, false, false); }); - config_helper_.addFilter(compressorFilterConfig); + config_helper_.prependFilter(compressorFilterConfig); HttpProtocolIntegrationTest::initialize(); } diff --git a/test/extensions/filters/http/cors/cors_filter_integration_test.cc b/test/extensions/filters/http/cors/cors_filter_integration_test.cc index 77a0522b4bed2..00bd075b37a92 100644 --- a/test/extensions/filters/http/cors/cors_filter_integration_test.cc +++ b/test/extensions/filters/http/cors/cors_filter_integration_test.cc @@ -14,7 +14,7 @@ class CorsFilterIntegrationTest : public testing::TestWithParam void { diff --git a/test/extensions/filters/http/csrf/csrf_filter_integration_test.cc b/test/extensions/filters/http/csrf/csrf_filter_integration_test.cc index 3b8055e79b5e5..c2dc6f4f10dc6 100644 --- a/test/extensions/filters/http/csrf/csrf_filter_integration_test.cc +++ b/test/extensions/filters/http/csrf/csrf_filter_integration_test.cc @@ -79,7 +79,7 @@ INSTANTIATE_TEST_SUITE_P(Protocols, CsrfFilterIntegrationTest, HttpProtocolIntegrationTest::protocolTestParamsToString); TEST_P(CsrfFilterIntegrationTest, TestCsrfSuccess) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "PUT"}, {":path", "/"}, @@ -93,7 +93,7 @@ TEST_P(CsrfFilterIntegrationTest, TestCsrfSuccess) { } TEST_P(CsrfFilterIntegrationTest, TestCsrfDisabled) { - config_helper_.addFilter(CSRF_DISABLED_CONFIG); + config_helper_.prependFilter(CSRF_DISABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "PUT"}, {":path", "/"}, @@ -107,7 +107,7 @@ TEST_P(CsrfFilterIntegrationTest, TestCsrfDisabled) { } TEST_P(CsrfFilterIntegrationTest, TestNonMutationMethod) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "GET"}, {":path", "/"}, @@ -121,7 +121,7 @@ TEST_P(CsrfFilterIntegrationTest, TestNonMutationMethod) { } TEST_P(CsrfFilterIntegrationTest, TestOriginMismatch) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "PUT"}, {":path", "/"}, @@ -135,7 +135,7 @@ TEST_P(CsrfFilterIntegrationTest, TestOriginMismatch) { } TEST_P(CsrfFilterIntegrationTest, TestEnforcesPost) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "POST"}, {":path", "/"}, @@ -149,7 +149,7 @@ TEST_P(CsrfFilterIntegrationTest, TestEnforcesPost) { } TEST_P(CsrfFilterIntegrationTest, TestEnforcesDelete) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "DELETE"}, {":path", "/"}, @@ -163,7 +163,7 @@ TEST_P(CsrfFilterIntegrationTest, TestEnforcesDelete) { } TEST_P(CsrfFilterIntegrationTest, TestEnforcesPatch) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "PATCH"}, {":path", "/"}, @@ -177,7 +177,7 @@ TEST_P(CsrfFilterIntegrationTest, TestEnforcesPatch) { } TEST_P(CsrfFilterIntegrationTest, TestRefererFallback) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{":method", "DELETE"}, {":path", "/"}, {":scheme", "http"}, @@ -189,7 +189,7 @@ TEST_P(CsrfFilterIntegrationTest, TestRefererFallback) { } TEST_P(CsrfFilterIntegrationTest, TestMissingOrigin) { - config_helper_.addFilter(CSRF_FILTER_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_FILTER_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = { {{":method", "DELETE"}, {":path", "/"}, {":scheme", "http"}, {"host", "test-origin"}}}; const auto& response = sendRequest(headers); @@ -198,7 +198,7 @@ TEST_P(CsrfFilterIntegrationTest, TestMissingOrigin) { } TEST_P(CsrfFilterIntegrationTest, TestShadowOnlyMode) { - config_helper_.addFilter(CSRF_SHADOW_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_SHADOW_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "PUT"}, {":path", "/"}, @@ -212,7 +212,7 @@ TEST_P(CsrfFilterIntegrationTest, TestShadowOnlyMode) { } TEST_P(CsrfFilterIntegrationTest, TestFilterAndShadowEnabled) { - config_helper_.addFilter(CSRF_ENABLED_CONFIG); + config_helper_.prependFilter(CSRF_ENABLED_CONFIG); Http::TestRequestHeaderMapImpl headers = {{ {":method", "PUT"}, {":path", "/"}, 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 30c6f5117ee75..9d2d4b7bd6b13 100644 --- a/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc +++ b/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc @@ -30,7 +30,7 @@ class DecompressorIntegrationTest : public testing::TestWithParamPackFrom(proto_config_); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_authz_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_authz_filter)); }); } @@ -506,7 +506,7 @@ class ExtAuthzHttpIntegrationTest : public HttpIntegrationTest, ext_authz_filter.set_name("envoy.filters.http.ext_authz"); ext_authz_filter.mutable_typed_config()->PackFrom(proto_config_); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_authz_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_authz_filter)); }); } @@ -795,7 +795,7 @@ TEST_P(ExtAuthzLocalReplyIntegrationTest, DeniedHeaderTest) { envoy::config::listener::v3::Filter ext_authz_filter; ext_authz_filter.set_name("envoy.filters.http.ext_authz"); ext_authz_filter.mutable_typed_config()->PackFrom(proto_config); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_authz_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_authz_filter)); }); const std::string local_reply_yaml = R"EOF( diff --git a/test/extensions/filters/http/ext_proc/ext_proc_grpc_fuzz.cc b/test/extensions/filters/http/ext_proc/ext_proc_grpc_fuzz.cc index 85f01a408c12f..c03cafa52ada7 100644 --- a/test/extensions/filters/http/ext_proc/ext_proc_grpc_fuzz.cc +++ b/test/extensions/filters/http/ext_proc/ext_proc_grpc_fuzz.cc @@ -101,7 +101,7 @@ class ExtProcIntegrationFuzz : public HttpIntegrationTest, envoy::config::listener::v3::Filter ext_proc_filter; ext_proc_filter.set_name("envoy.filters.http.ext_proc"); ext_proc_filter.mutable_typed_config()->PackFrom(proto_config_); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); }); // Make sure that we have control over when buffers will fill up. 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 f84e0342e52c4..7dc977d926406 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 @@ -86,7 +86,7 @@ class ExtProcIntegrationTest : public HttpIntegrationTest, envoy::config::listener::v3::Filter ext_proc_filter; ext_proc_filter.set_name("envoy.filters.http.ext_proc"); ext_proc_filter.mutable_typed_config()->PackFrom(proto_config_); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); }); setUpstreamProtocol(Http::CodecType::HTTP2); setDownstreamProtocol(Http::CodecType::HTTP2); diff --git a/test/extensions/filters/http/ext_proc/streaming_integration_test.cc b/test/extensions/filters/http/ext_proc/streaming_integration_test.cc index 8bbc35672982c..4e47554838335 100644 --- a/test/extensions/filters/http/ext_proc/streaming_integration_test.cc +++ b/test/extensions/filters/http/ext_proc/streaming_integration_test.cc @@ -74,7 +74,7 @@ class StreamingIntegrationTest : public HttpIntegrationTest, envoy::config::listener::v3::Filter ext_proc_filter; ext_proc_filter.set_name("envoy.filters.http.ext_proc"); ext_proc_filter.mutable_typed_config()->PackFrom(proto_config_); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ext_proc_filter)); }); // Make sure that we have control over when buffers will fill up. 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 370c662438bee..ed4eaf587af6c 100644 --- a/test/extensions/filters/http/fault/fault_filter_integration_test.cc +++ b/test/extensions/filters/http/fault/fault_filter_integration_test.cc @@ -13,7 +13,7 @@ class FaultIntegrationTest : public Event::TestUsingSimulatedTime, public HttpProtocolIntegrationTest { public: void initializeFilter(const std::string& filter_config) { - config_helper_.addFilter(filter_config); + config_helper_.prependFilter(filter_config); initialize(); } 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 12e1b7b836d56..9a05608688b5d 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 @@ -42,7 +42,7 @@ name: grpc_http1_reverse_bridge response_size_header: "{}" )EOF", response_size_header ? *response_size_header : ""); - config_helper_.addFilter(filter); + config_helper_.prependFilter(filter); auto vhost = config_helper_.createVirtualHost("disabled"); envoy::extensions::filters::http::grpc_http1_reverse_bridge::v3::FilterConfigPerRoute 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 2dd86455f58b7..99baf6b1789b1 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 @@ -40,7 +40,7 @@ class GrpcJsonTranscoderIntegrationTest proto_descriptor : "{}" services : "bookstore.Bookstore" )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); } @@ -509,7 +509,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, UnaryGetError1) { services : "bookstore.Bookstore" ignore_unknown_query_parameters : true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); testTranscoding( @@ -533,7 +533,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, UnaryErrorConvertedToJson) { services: "bookstore.Bookstore" convert_grpc_status: true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); testTranscoding( @@ -558,7 +558,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, UnaryErrorInTrailerConvertedToJson) { services: "bookstore.Bookstore" convert_grpc_status: true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); testTranscoding( @@ -583,7 +583,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, StreamingErrorConvertedToJson) { services: "bookstore.Bookstore" convert_grpc_status: true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); testTranscoding( @@ -977,7 +977,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, RejectUnknownMethod) { request_validation_options: reject_unknown_method: true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); @@ -1030,7 +1030,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, RejectUnknownQueryParam) { request_validation_options: reject_unknown_query_parameters: true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); @@ -1086,7 +1086,7 @@ TEST_P(GrpcJsonTranscoderIntegrationTest, EnableRequestValidationIgnoreQueryPara reject_unknown_method: true reject_unknown_query_parameters: true )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); HttpIntegrationTest::initialize(); @@ -1258,7 +1258,7 @@ class OverrideConfigGrpcJsonTranscoderIntegrationTest : public GrpcJsonTranscode "@type": type.googleapis.com/envoy.extensions.filters.http.grpc_json_transcoder.v3.GrpcJsonTranscoder "proto_descriptor": "" )EOF"; - config_helper_.addFilter(filter); + config_helper_.prependFilter(filter); } }; INSTANTIATE_TEST_SUITE_P(IpVersions, OverrideConfigGrpcJsonTranscoderIntegrationTest, @@ -1306,7 +1306,7 @@ class BufferLimitsDisabledGrpcJsonTranscoderIntegrationTest proto_descriptor : "{}" services : "bookstore.Bookstore" )EOF"; - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(filter, TestEnvironment::runfilesPath("test/proto/bookstore.descriptor"))); // Disable runtime feature. 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 b7ba884e65965..235168207001c 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 @@ -27,7 +27,7 @@ class GrpcWebFilterIntegrationTest : public testing::TestWithParam, void SetUp() override { setUpstreamProtocol(Http::CodecType::HTTP2); - config_helper_.addFilter("name: envoy.filters.http.grpc_web"); + config_helper_.prependFilter("name: envoy.filters.http.grpc_web"); } void initialize() override { diff --git a/test/extensions/filters/http/jwt_authn/filter_integration_test.cc b/test/extensions/filters/http/jwt_authn/filter_integration_test.cc index f0ef92af55616..98fea932bc868 100644 --- a/test/extensions/filters/http/jwt_authn/filter_integration_test.cc +++ b/test/extensions/filters/http/jwt_authn/filter_integration_test.cc @@ -107,7 +107,7 @@ INSTANTIATE_TEST_SUITE_P(Protocols, LocalJwksIntegrationTest, // With local Jwks, this test verifies a request is passed with a good Jwt token. TEST_P(LocalJwksIntegrationTest, WithGoodToken) { - config_helper_.addFilter(getFilterConfig(true)); + config_helper_.prependFilter(getFilterConfig(true)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -135,7 +135,7 @@ TEST_P(LocalJwksIntegrationTest, WithGoodToken) { // With local Jwks, this test verifies a request is rejected with an expired Jwt token. TEST_P(LocalJwksIntegrationTest, ExpiredToken) { - config_helper_.addFilter(getFilterConfig(true)); + config_helper_.prependFilter(getFilterConfig(true)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -158,7 +158,7 @@ TEST_P(LocalJwksIntegrationTest, ExpiredToken) { } TEST_P(LocalJwksIntegrationTest, MissingToken) { - config_helper_.addFilter(getFilterConfig(true)); + config_helper_.prependFilter(getFilterConfig(true)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -179,7 +179,7 @@ TEST_P(LocalJwksIntegrationTest, MissingToken) { } TEST_P(LocalJwksIntegrationTest, ExpiredTokenHeadReply) { - config_helper_.addFilter(getFilterConfig(true)); + config_helper_.prependFilter(getFilterConfig(true)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -205,7 +205,7 @@ TEST_P(LocalJwksIntegrationTest, ExpiredTokenHeadReply) { // This test verifies a request is passed with a path that don't match any requirements. TEST_P(LocalJwksIntegrationTest, NoRequiresPath) { - config_helper_.addFilter(getFilterConfig(true)); + config_helper_.prependFilter(getFilterConfig(true)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -227,7 +227,7 @@ TEST_P(LocalJwksIntegrationTest, NoRequiresPath) { // This test verifies a CORS preflight request without JWT token is allowed. TEST_P(LocalJwksIntegrationTest, CorsPreflight) { - config_helper_.addFilter(getFilterConfig(true)); + config_helper_.prependFilter(getFilterConfig(true)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -264,8 +264,8 @@ TEST_P(LocalJwksIntegrationTest, FilterStateRequirement) { provider_name: example_provider )"; - config_helper_.addFilter(getAuthFilterConfig(auth_filter_conf, true)); - config_helper_.addFilter(absl::StrCat("name: ", HeaderToFilterStateFilterName)); + config_helper_.prependFilter(getAuthFilterConfig(auth_filter_conf, true)); + config_helper_.prependFilter(absl::StrCat("name: ", HeaderToFilterStateFilterName)); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -336,7 +336,7 @@ class RemoteJwksIntegrationTest : public HttpProtocolIntegrationTest { } void initializeFilter(bool add_cluster) { - config_helper_.addFilter(getFilterConfig(false)); + config_helper_.prependFilter(getFilterConfig(false)); if (add_cluster) { config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { @@ -352,7 +352,7 @@ class RemoteJwksIntegrationTest : public HttpProtocolIntegrationTest { } void initializeAsyncFetchFilter(bool fast_listener) { - config_helper_.addFilter(getAsyncFetchFilterConfig(ExampleConfig, fast_listener)); + config_helper_.prependFilter(getAsyncFetchFilterConfig(ExampleConfig, fast_listener)); config_helper_.addConfigModifier([](envoy::config::bootstrap::v3::Bootstrap& bootstrap) { auto* jwks_cluster = bootstrap.mutable_static_resources()->add_clusters(); @@ -605,7 +605,7 @@ TEST_P(RemoteJwksIntegrationTest, WithFailedJwksAsyncFetchFast) { class PerRouteIntegrationTest : public HttpProtocolIntegrationTest { public: void setup(const std::string& filter_config, const PerRouteConfig& per_route) { - config_helper_.addFilter(getAuthFilterConfig(filter_config, true)); + config_helper_.prependFilter(getAuthFilterConfig(filter_config, true)); config_helper_.addConfigModifier( [per_route]( diff --git a/test/extensions/filters/http/kill_request/crash_integration_test.cc b/test/extensions/filters/http/kill_request/crash_integration_test.cc index ec68ab95e298e..6eda4c89effda 100644 --- a/test/extensions/filters/http/kill_request/crash_integration_test.cc +++ b/test/extensions/filters/http/kill_request/crash_integration_test.cc @@ -24,7 +24,7 @@ class CrashIntegrationTest : public Event::TestUsingSimulatedTime, public HttpProtocolIntegrationTest { protected: void initializeFilter(const std::string& filter_config) { - config_helper_.addFilter(filter_config); + config_helper_.prependFilter(filter_config); initialize(); } }; @@ -102,7 +102,7 @@ TEST_P(CrashIntegrationTestAllProtocols, DecodeContinueDoesNotAddTrackedObjectIf probability: numerator: 100 )EOF"; - config_helper_.addFilter(request_kill_config); + config_helper_.prependFilter(request_kill_config); // This will stop iteration, and continue via a callback. const std::string stop_and_continue_config = R"EOF( @@ -111,7 +111,7 @@ TEST_P(CrashIntegrationTestAllProtocols, DecodeContinueDoesNotAddTrackedObjectIf "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig installScopeTrackedObject: true )EOF"; - config_helper_.addFilter(stop_and_continue_config); + config_helper_.prependFilter(stop_and_continue_config); initialize(); @@ -137,7 +137,7 @@ TEST_P(CrashIntegrationTestAllProtocols, DecodeContinueAddsCrashContextIfNoneExi probability: numerator: 100 )EOF"; - config_helper_.addFilter(request_kill_config); + config_helper_.prependFilter(request_kill_config); // This will stop iteration, and continue via a callback. const std::string stop_and_continue_config = R"EOF( @@ -146,7 +146,7 @@ TEST_P(CrashIntegrationTestAllProtocols, DecodeContinueAddsCrashContextIfNoneExi "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig installScopeTrackedObject: false )EOF"; - config_helper_.addFilter(stop_and_continue_config); + config_helper_.prependFilter(stop_and_continue_config); initialize(); @@ -172,7 +172,7 @@ TEST_P(CrashIntegrationTestAllProtocols, EncodeContinueDoesNotAddTrackedObjectIf "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig installScopeTrackedObject: true )EOF"; - config_helper_.addFilter(stop_and_continue_config); + config_helper_.prependFilter(stop_and_continue_config); const std::string request_kill_config = R"EOF( @@ -183,7 +183,7 @@ TEST_P(CrashIntegrationTestAllProtocols, EncodeContinueDoesNotAddTrackedObjectIf numerator: 100 direction: RESPONSE )EOF"; - config_helper_.addFilter(request_kill_config); + config_helper_.prependFilter(request_kill_config); initialize(); @@ -205,7 +205,7 @@ TEST_P(CrashIntegrationTestAllProtocols, EncodeContinueAddsCrashContextIfNoneExi "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig installScopeTrackedObject: false )EOF"; - config_helper_.addFilter(stop_and_continue_config); + config_helper_.prependFilter(stop_and_continue_config); const std::string request_kill_config = R"EOF( @@ -216,7 +216,7 @@ TEST_P(CrashIntegrationTestAllProtocols, EncodeContinueAddsCrashContextIfNoneExi numerator: 100 direction: RESPONSE )EOF"; - config_helper_.addFilter(request_kill_config); + config_helper_.prependFilter(request_kill_config); initialize(); diff --git a/test/extensions/filters/http/kill_request/kill_request_filter_integration_test.cc b/test/extensions/filters/http/kill_request/kill_request_filter_integration_test.cc index d995c10aad043..6d9a173b99658 100644 --- a/test/extensions/filters/http/kill_request/kill_request_filter_integration_test.cc +++ b/test/extensions/filters/http/kill_request/kill_request_filter_integration_test.cc @@ -12,7 +12,7 @@ class KillRequestFilterIntegrationTest : public Event::TestUsingSimulatedTime, public HttpProtocolIntegrationTest { protected: void initializeFilter(const std::string& filter_config) { - config_helper_.addFilter(filter_config); + config_helper_.prependFilter(filter_config); initialize(); } diff --git a/test/extensions/filters/http/local_ratelimit/local_ratelimit_integration_test.cc b/test/extensions/filters/http/local_ratelimit/local_ratelimit_integration_test.cc index 06a8b0ca1b3f3..784dc656f3cb9 100644 --- a/test/extensions/filters/http/local_ratelimit/local_ratelimit_integration_test.cc +++ b/test/extensions/filters/http/local_ratelimit/local_ratelimit_integration_test.cc @@ -9,7 +9,7 @@ class LocalRateLimitFilterIntegrationTest : public Event::TestUsingSimulatedTime public HttpProtocolIntegrationTest { protected: void initializeFilter(const std::string& filter_config) { - config_helper_.addFilter(filter_config); + config_helper_.prependFilter(filter_config); initialize(); } diff --git a/test/extensions/filters/http/lua/lua_integration_test.cc b/test/extensions/filters/http/lua/lua_integration_test.cc index a1ec02924953c..35bd0a9267670 100644 --- a/test/extensions/filters/http/lua/lua_integration_test.cc +++ b/test/extensions/filters/http/lua/lua_integration_test.cc @@ -26,7 +26,7 @@ class LuaIntegrationTest : public testing::TestWithParamPackFrom(proto_config_); - config_helper_.addFilter(MessageUtil::getJsonStringFromMessageOrDie(ratelimit_filter)); + config_helper_.prependFilter(MessageUtil::getJsonStringFromMessageOrDie(ratelimit_filter)); }); config_helper_.addConfigModifier( [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& diff --git a/test/extensions/filters/http/rbac/rbac_filter_integration_test.cc b/test/extensions/filters/http/rbac/rbac_filter_integration_test.cc index 90bbeb81006d4..242ad7684071d 100644 --- a/test/extensions/filters/http/rbac/rbac_filter_integration_test.cc +++ b/test/extensions/filters/http/rbac/rbac_filter_integration_test.cc @@ -152,7 +152,7 @@ INSTANTIATE_TEST_SUITE_P(Protocols, RBACIntegrationTest, TEST_P(RBACIntegrationTest, Allowed) { useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter(RBAC_CONFIG); + config_helper_.prependFilter(RBAC_CONFIG); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -177,7 +177,7 @@ TEST_P(RBACIntegrationTest, Allowed) { TEST_P(RBACIntegrationTest, Denied) { useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter(RBAC_CONFIG); + config_helper_.prependFilter(RBAC_CONFIG); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -200,7 +200,7 @@ TEST_P(RBACIntegrationTest, Denied) { TEST_P(RBACIntegrationTest, DeniedWithDenyAction) { useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter(RBAC_CONFIG_WITH_DENY_ACTION); + config_helper_.prependFilter(RBAC_CONFIG_WITH_DENY_ACTION); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -226,7 +226,7 @@ TEST_P(RBACIntegrationTest, DeniedWithPrefixRule) { config_helper_.addConfigModifier( [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& cfg) { cfg.mutable_normalize_path()->set_value(false); }); - config_helper_.addFilter(RBAC_CONFIG_WITH_PREFIX_MATCH); + config_helper_.prependFilter(RBAC_CONFIG_WITH_PREFIX_MATCH); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -252,7 +252,7 @@ TEST_P(RBACIntegrationTest, RbacPrefixRuleUseNormalizePath) { config_helper_.addConfigModifier( [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& cfg) { cfg.mutable_normalize_path()->set_value(true); }); - config_helper_.addFilter(RBAC_CONFIG_WITH_PREFIX_MATCH); + config_helper_.prependFilter(RBAC_CONFIG_WITH_PREFIX_MATCH); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -273,7 +273,7 @@ TEST_P(RBACIntegrationTest, RbacPrefixRuleUseNormalizePath) { } TEST_P(RBACIntegrationTest, DeniedHeadReply) { - config_helper_.addFilter(RBAC_CONFIG); + config_helper_.prependFilter(RBAC_CONFIG); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -309,7 +309,7 @@ TEST_P(RBACIntegrationTest, RouteOverride) { (*config)["envoy.filters.http.rbac"].PackFrom(per_route_config); }); - config_helper_.addFilter(RBAC_CONFIG); + config_helper_.prependFilter(RBAC_CONFIG); initialize(); @@ -333,7 +333,7 @@ TEST_P(RBACIntegrationTest, RouteOverride) { } TEST_P(RBACIntegrationTest, PathWithQueryAndFragmentWithOverride) { - config_helper_.addFilter(RBAC_CONFIG_WITH_PATH_EXACT_MATCH); + config_helper_.prependFilter(RBAC_CONFIG_WITH_PATH_EXACT_MATCH); config_helper_.addRuntimeOverride("envoy.reloadable_features.http_reject_path_with_fragment", "false"); initialize(); @@ -362,7 +362,7 @@ TEST_P(RBACIntegrationTest, PathWithQueryAndFragmentWithOverride) { } TEST_P(RBACIntegrationTest, PathWithFragmentRejectedByDefault) { - config_helper_.addFilter(RBAC_CONFIG_WITH_PATH_EXACT_MATCH); + config_helper_.prependFilter(RBAC_CONFIG_WITH_PATH_EXACT_MATCH); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -385,7 +385,7 @@ TEST_P(RBACIntegrationTest, PathWithFragmentRejectedByDefault) { // This test ensures that the exact match deny rule is not affected by fragment and query // when Envoy is configured to strip both fragment and query. TEST_P(RBACIntegrationTest, DenyExactMatchIgnoresQueryAndFragment) { - config_helper_.addFilter(RBAC_CONFIG_DENY_WITH_PATH_EXACT_MATCH); + config_helper_.prependFilter(RBAC_CONFIG_DENY_WITH_PATH_EXACT_MATCH); config_helper_.addRuntimeOverride("envoy.reloadable_features.http_reject_path_with_fragment", "false"); initialize(); @@ -418,7 +418,7 @@ TEST_P(RBACIntegrationTest, DenyExactMatchIgnoresQueryAndFragment) { } TEST_P(RBACIntegrationTest, PathIgnoreCase) { - config_helper_.addFilter(RBAC_CONFIG_WITH_PATH_IGNORE_CASE_MATCH); + config_helper_.prependFilter(RBAC_CONFIG_WITH_PATH_IGNORE_CASE_MATCH); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -445,7 +445,7 @@ TEST_P(RBACIntegrationTest, PathIgnoreCase) { } TEST_P(RBACIntegrationTest, LogConnectionAllow) { - config_helper_.addFilter(RBAC_CONFIG_WITH_LOG_ACTION); + config_helper_.prependFilter(RBAC_CONFIG_WITH_LOG_ACTION); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -469,7 +469,7 @@ TEST_P(RBACIntegrationTest, LogConnectionAllow) { // Basic CEL match on a header value. TEST_P(RBACIntegrationTest, HeaderMatchCondition) { - config_helper_.addFilter(fmt::format(RBAC_CONFIG_HEADER_MATCH_CONDITION, "yyy")); + config_helper_.prependFilter(fmt::format(RBAC_CONFIG_HEADER_MATCH_CONDITION, "yyy")); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -494,7 +494,7 @@ TEST_P(RBACIntegrationTest, HeaderMatchCondition) { // CEL match on a header value in which the header is a duplicate. Verifies we handle string // copying correctly inside the CEL expression. TEST_P(RBACIntegrationTest, HeaderMatchConditionDuplicateHeaderNoMatch) { - config_helper_.addFilter(fmt::format(RBAC_CONFIG_HEADER_MATCH_CONDITION, "yyy")); + config_helper_.prependFilter(fmt::format(RBAC_CONFIG_HEADER_MATCH_CONDITION, "yyy")); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -517,7 +517,7 @@ TEST_P(RBACIntegrationTest, HeaderMatchConditionDuplicateHeaderNoMatch) { // CEL match on a header value in which the header is a duplicate. Verifies we handle string // copying correctly inside the CEL expression. TEST_P(RBACIntegrationTest, HeaderMatchConditionDuplicateHeaderMatch) { - config_helper_.addFilter(fmt::format(RBAC_CONFIG_HEADER_MATCH_CONDITION, "yyy,zzz")); + config_helper_.prependFilter(fmt::format(RBAC_CONFIG_HEADER_MATCH_CONDITION, "yyy,zzz")); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); diff --git a/test/extensions/filters/http/tap/tap_filter_integration_test.cc b/test/extensions/filters/http/tap/tap_filter_integration_test.cc index 403c5ca023847..cb60fb318f8ad 100644 --- a/test/extensions/filters/http/tap/tap_filter_integration_test.cc +++ b/test/extensions/filters/http/tap/tap_filter_integration_test.cc @@ -26,7 +26,7 @@ class TapIntegrationTest : public testing::TestWithParammutable_typed_config()->PackFrom(alts_config); }); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: decode-dynamic-metadata-filter typed_config: "@type": type.googleapis.com/google.protobuf.Empty diff --git a/test/integration/README.md b/test/integration/README.md index e36b9d4d031eb..99badc23e76b3 100644 --- a/test/integration/README.md +++ b/test/integration/README.md @@ -57,7 +57,7 @@ or ```c++ // Add a buffering filter on the request path -config_helper_.addFilter(ConfigHelper::DEFAULT_BUFFER_FILTER); +config_helper_.prependFilter(ConfigHelper::DEFAULT_BUFFER_FILTER); ``` For other edits which are less likely reusable, one can add config modifiers. Config modifiers diff --git a/test/integration/drain_close_integration_test.cc b/test/integration/drain_close_integration_test.cc index de57d7fcba64c..65b84f28bf0e9 100644 --- a/test/integration/drain_close_integration_test.cc +++ b/test/integration/drain_close_integration_test.cc @@ -11,7 +11,7 @@ TEST_P(DrainCloseIntegrationTest, DrainCloseGradual) { // the probability will be very low, but the rapid retries prevent this from // increasing total test time. drain_time_ = std::chrono::seconds(100); - config_helper_.addFilter(ConfigHelper::defaultHealthCheckFilter()); + config_helper_.prependFilter(ConfigHelper::defaultHealthCheckFilter()); initialize(); absl::Notification drain_sequence_started; @@ -45,7 +45,7 @@ TEST_P(DrainCloseIntegrationTest, DrainCloseGradual) { TEST_P(DrainCloseIntegrationTest, DrainCloseImmediate) { drain_strategy_ = Server::DrainStrategy::Immediate; drain_time_ = std::chrono::seconds(100); - config_helper_.addFilter(ConfigHelper::defaultHealthCheckFilter()); + config_helper_.prependFilter(ConfigHelper::defaultHealthCheckFilter()); initialize(); absl::Notification drain_sequence_started; diff --git a/test/integration/eds_integration_test.cc b/test/integration/eds_integration_test.cc index 2f2b47d69302d..bfe7ec4c24a06 100644 --- a/test/integration/eds_integration_test.cc +++ b/test/integration/eds_integration_test.cc @@ -408,7 +408,7 @@ TEST_P(EdsIntegrationTest, BatchMemberUpdateCb) { } TEST_P(EdsIntegrationTest, StatsReadyFilter) { - config_helper_.addFilter("name: eds-ready-filter"); + config_helper_.prependFilter("name: eds-ready-filter"); initializeTest(false); // Initial state: no healthy endpoints diff --git a/test/integration/http2_flood_integration_test.cc b/test/integration/http2_flood_integration_test.cc index 64db06468019e..a5c9d864fb7d2 100644 --- a/test/integration/http2_flood_integration_test.cc +++ b/test/integration/http2_flood_integration_test.cc @@ -577,7 +577,7 @@ TEST_P(Http2FloodMitigationTest, Trailers) { // Verify flood detection by the WINDOW_UPDATE frame when a decoder filter is resuming reading from // the downstream via DecoderFilterBelowWriteBufferLowWatermark. TEST_P(Http2FloodMitigationTest, WindowUpdateOnLowWatermarkFlood) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: backpressure-filter )EOF"); config_helper_.setBufferLimits(1024 * 1024 * 1024, 1024 * 1024 * 1024); diff --git a/test/integration/http_integration.cc b/test/integration/http_integration.cc index 3cb411a0c730a..4403d39b23171 100644 --- a/test/integration/http_integration.cc +++ b/test/integration/http_integration.cc @@ -1000,7 +1000,7 @@ void HttpIntegrationTest::testEnvoyProxying1xx(bool continue_before_upstream_com bool with_multiple_1xx_headers) { if (with_encoder_filter) { // Add a filter to make sure 100s play well with them. - config_helper_.addFilter("name: passthrough-filter"); + config_helper_.prependFilter("name: passthrough-filter"); } config_helper_.addConfigModifier( [&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& @@ -1071,7 +1071,7 @@ void HttpIntegrationTest::testTwoRequests(bool network_backup) { // created while the socket appears to be in the high watermark state, and regression tests that // flow control will be corrected as the socket "becomes unblocked" if (network_backup) { - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(R"EOF( name: pause-filter{} typed_config: diff --git a/test/integration/idle_timeout_integration_test.cc b/test/integration/idle_timeout_integration_test.cc index 9a8e0f75e1972..46cbe957e6ae5 100644 --- a/test/integration/idle_timeout_integration_test.cc +++ b/test/integration/idle_timeout_integration_test.cc @@ -194,7 +194,7 @@ TEST_P(IdleTimeoutIntegrationTest, PerStreamIdleTimeoutAfterDownstreamHeaders) { // Per-stream idle timeout with reads disabled. TEST_P(IdleTimeoutIntegrationTest, PerStreamIdleTimeoutWithLargeBuffer) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: backpressure-filter )EOF"); enable_per_stream_idle_timeout_ = true; @@ -413,7 +413,7 @@ TEST_P(IdleTimeoutIntegrationTest, RequestTimeoutIsNotDisarmedByEncode100Continu // Per-stream idle timeout reset from within a filter. TEST_P(IdleTimeoutIntegrationTest, PerStreamIdleTimeoutResetFromFilter) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: reset-idle-timer-filter )EOF"); enable_per_stream_idle_timeout_ = true; diff --git a/test/integration/integration_admin_test.cc b/test/integration/integration_admin_test.cc index 578017e301112..6fdc3bd7467cd 100644 --- a/test/integration/integration_admin_test.cc +++ b/test/integration/integration_admin_test.cc @@ -69,7 +69,7 @@ TEST_P(IntegrationAdminTest, HealthCheckWithoutServerStats) { } TEST_P(IntegrationAdminTest, HealthCheckWithBufferFilter) { - config_helper_.addFilter(ConfigHelper::defaultBufferFilter()); + config_helper_.prependFilter(ConfigHelper::defaultBufferFilter()); initialize(); BufferingStreamDecoderPtr response; diff --git a/test/integration/integration_admin_test.h b/test/integration/integration_admin_test.h index 194c54d02ae00..b190cef6edbaf 100644 --- a/test/integration/integration_admin_test.h +++ b/test/integration/integration_admin_test.h @@ -15,7 +15,7 @@ namespace Envoy { class IntegrationAdminTest : public HttpProtocolIntegrationTest { public: void initialize() override { - config_helper_.addFilter(ConfigHelper::defaultHealthCheckFilter()); + config_helper_.prependFilter(ConfigHelper::defaultHealthCheckFilter()); config_helper_.addConfigModifier( [](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void { auto& hist_settings = diff --git a/test/integration/integration_test.cc b/test/integration/integration_test.cc index 450e787dd71e1..794a49adda065 100644 --- a/test/integration/integration_test.cc +++ b/test/integration/integration_test.cc @@ -303,7 +303,7 @@ TEST_P(IntegrationTest, RouterDirectResponseEmptyBody) { } TEST_P(IntegrationTest, ConnectionClose) { - config_helper_.addFilter(ConfigHelper::defaultHealthCheckFilter()); + config_helper_.prependFilter(ConfigHelper::defaultHealthCheckFilter()); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -419,7 +419,7 @@ TEST_P(IntegrationTest, EnvoyProxyingLate100ContinueWithEncoderFilter) { // Regression test for https://github.com/envoyproxy/envoy/issues/10923. TEST_P(IntegrationTest, EnvoyProxying100ContinueWithDecodeDataPause) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: stop-iteration-and-continue-filter typed_config: "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig @@ -433,7 +433,7 @@ TEST_P(IntegrationTest, MatchingHttpFilterConstruction) { concurrency_ = 2; config_helper_.addRuntimeOverride("envoy.reloadable_features.experimental_matching_api", "true"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: matcher typed_config: "@type": type.googleapis.com/envoy.extensions.common.matching.v3.ExtensionWithMatcher @@ -500,7 +500,7 @@ TEST_P(IntegrationTest, MatchingHttpFilterConstructionNewProto) { concurrency_ = 2; config_helper_.addRuntimeOverride("envoy.reloadable_features.experimental_matching_api", "true"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: matcher typed_config: "@type": type.googleapis.com/envoy.extensions.common.matching.v3.ExtensionWithMatcher @@ -625,7 +625,7 @@ TEST_P(IntegrationTest, UpstreamDisconnectWithTwoRequests) { // Test hitting the bridge filter with too many response bytes to buffer. Given // the headers are not proxied, the connection manager will send a local error reply. TEST_P(IntegrationTest, HittingGrpcFilterLimitBufferingHeaders) { - config_helper_.addFilter( + config_helper_.prependFilter( "{ name: grpc_http1_bridge, typed_config: { \"@type\": " "type.googleapis.com/envoy.extensions.filters.http.grpc_http1_bridge.v3.Config } }"); config_helper_.setBufferLimits(1024, 1024); @@ -1480,8 +1480,8 @@ TEST_P(IntegrationTest, TestDelayedConnectionTeardownOnGracefulClose) { hcm) { hcm.mutable_delayed_close_timeout()->set_seconds(1); }); // This test will trigger an early 413 Payload Too Large response due to buffer limits being // exceeded. The following filter is needed since the router filter will never trigger a 413. - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.setBufferLimits(1024, 1024); initialize(); @@ -1513,8 +1513,8 @@ TEST_P(IntegrationTest, TestDelayedConnectionTeardownOnGracefulClose) { // Test configuration of the delayed close timeout on downstream HTTP/1.1 connections. A value of 0 // disables delayed close processing. TEST_P(IntegrationTest, TestDelayedConnectionTeardownConfig) { - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.setBufferLimits(1024, 1024); config_helper_.addConfigModifier( [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& @@ -1547,8 +1547,8 @@ TEST_P(IntegrationTest, TestDelayedConnectionTeardownConfig) { // Test that if the route cache is cleared, it doesn't cause problems. TEST_P(IntegrationTest, TestClearingRouteCacheFilter) { - config_helper_.addFilter("{ name: clear-route-cache, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: clear-route-cache, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); sendRequestAndWaitForResponse(default_request_headers_, 0, default_response_headers_, 0); @@ -1585,8 +1585,8 @@ TEST_P(IntegrationTest, NoConnectionPoolsFree) { } TEST_P(IntegrationTest, ProcessObjectHealthy) { - config_helper_.addFilter("{ name: process-context-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: process-context-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); ProcessObjectForFilter healthy_object(true); process_object_ = healthy_object; @@ -1606,8 +1606,8 @@ TEST_P(IntegrationTest, ProcessObjectHealthy) { } TEST_P(IntegrationTest, ProcessObjectUnealthy) { - config_helper_.addFilter("{ name: process-context-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: process-context-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); ProcessObjectForFilter unhealthy_object(false); process_object_ = unhealthy_object; @@ -2103,7 +2103,7 @@ TEST_P(IntegrationTest, RandomPreconnect) { TEST_P(IntegrationTest, SetRouteToDelegatingRouteWithClusterOverride) { useAccessLog("%UPSTREAM_CLUSTER%\n"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: set-route-filter )EOF"); diff --git a/test/integration/multiplexed_integration_test.cc b/test/integration/multiplexed_integration_test.cc index c55fc1dabfbeb..77584bafc2ee4 100644 --- a/test/integration/multiplexed_integration_test.cc +++ b/test/integration/multiplexed_integration_test.cc @@ -852,7 +852,7 @@ TEST_P(Http2MetadataIntegrationTest, RequestMetadataWithStopAllFilterAfterMetada } TEST_P(Http2MetadataIntegrationTest, TestAddEncodedMetadata) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: encode-headers-return-stop-all-filter )EOF"); @@ -957,7 +957,7 @@ TEST_P(Http2IntegrationTest, BadFrame) { // response are received. TEST_P(Http2IntegrationTest, GoAway) { EXCLUDE_DOWNSTREAM_HTTP3; // QuicHttpClientConnectionImpl::goAway NOT_REACHED_GCOVR_EXCL_LINE - config_helper_.addFilter(ConfigHelper::defaultHealthCheckFilter()); + config_helper_.prependFilter(ConfigHelper::defaultHealthCheckFilter()); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -1319,7 +1319,7 @@ TEST_P(Http2IntegrationTest, DelayedCloseDisabled) { } TEST_P(Http2IntegrationTest, PauseAndResume) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: stop-iteration-and-continue-filter typed_config: "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig @@ -1349,7 +1349,7 @@ TEST_P(Http2IntegrationTest, PauseAndResume) { } TEST_P(Http2IntegrationTest, PauseAndResumeHeadersOnly) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: stop-iteration-and-continue-filter typed_config: "@type": type.googleapis.com/test.integration.filters.StopAndContinueConfig @@ -1829,7 +1829,7 @@ name: on-local-reply-filter )EOF"; TEST_P(Http2IntegrationTest, OnLocalReply) { - config_helper_.addFilter(on_local_reply_filter); + config_helper_.prependFilter(on_local_reply_filter); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); diff --git a/test/integration/multiplexed_integration_test.h b/test/integration/multiplexed_integration_test.h index f2bd7ce3267b3..0c059d1b41f00 100644 --- a/test/integration/multiplexed_integration_test.h +++ b/test/integration/multiplexed_integration_test.h @@ -19,7 +19,7 @@ class Http2IntegrationTest : public HttpProtocolIntegrationTest { // Utility function to add filters. void addFilters(std::vector filters) { for (const auto& filter : filters) { - config_helper_.addFilter(filter); + config_helper_.prependFilter(filter); } } }; diff --git a/test/integration/multiplexed_upstream_integration_test.cc b/test/integration/multiplexed_upstream_integration_test.cc index 694aebb9d41c7..6dedddbdea612 100644 --- a/test/integration/multiplexed_upstream_integration_test.cc +++ b/test/integration/multiplexed_upstream_integration_test.cc @@ -334,7 +334,7 @@ TEST_P(Http2UpstreamIntegrationTest, ManyLargeSimultaneousRequestWithRandomBacku // receiving flow control window updates. return; } - config_helper_.addFilter( + config_helper_.prependFilter( fmt::format(R"EOF( name: pause-filter{} typed_config: @@ -432,8 +432,8 @@ name: router // As with ProtocolIntegrationTest.HittingEncoderFilterLimit use a filter // which buffers response data but in this case, make sure the sendLocalReply // is gRPC. - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.setBufferLimits(1024, 1024); initialize(); diff --git a/test/integration/protocol_integration_test.cc b/test/integration/protocol_integration_test.cc index 2b1bfb5485efe..e6349bd3b8f88 100644 --- a/test/integration/protocol_integration_test.cc +++ b/test/integration/protocol_integration_test.cc @@ -172,7 +172,7 @@ TEST_P(ProtocolIntegrationTest, UnknownResponsecode) { // Add a health check filter and verify correct computation of health based on upstream status. TEST_P(DownstreamProtocolIntegrationTest, ComputedHealthCheck) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: health_check typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck @@ -193,7 +193,7 @@ name: health_check // Add a health check filter and verify correct computation of health based on upstream status. TEST_P(DownstreamProtocolIntegrationTest, ModifyBuffer) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: health_check typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck @@ -214,11 +214,10 @@ name: health_check // Verifies behavior for https://github.com/envoyproxy/envoy/pull/11248 TEST_P(ProtocolIntegrationTest, AddBodyToRequestAndWaitForIt) { - // filters are prepended, so add them in reverse order - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: wait-for-whole-request-and-response-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter )EOF"); initialize(); @@ -238,11 +237,10 @@ TEST_P(ProtocolIntegrationTest, AddBodyToRequestAndWaitForIt) { } TEST_P(ProtocolIntegrationTest, AddBodyToResponseAndWaitForIt) { - // filters are prepended, so add them in reverse order - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: wait-for-whole-request-and-response-filter )EOF"); initialize(); @@ -260,7 +258,7 @@ TEST_P(ProtocolIntegrationTest, AddBodyToResponseAndWaitForIt) { } TEST_P(ProtocolIntegrationTest, ContinueHeadersOnlyInjectBodyFilter) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: continue-headers-only-inject-body-filter typed_config: "@type": type.googleapis.com/google.protobuf.Empty @@ -288,7 +286,7 @@ TEST_P(ProtocolIntegrationTest, ContinueHeadersOnlyInjectBodyFilter) { } TEST_P(ProtocolIntegrationTest, AddEncodedTrailers) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-trailers-filter typed_config: "@type": type.googleapis.com/google.protobuf.Empty @@ -552,8 +550,8 @@ TEST_P(DownstreamProtocolIntegrationTest, DownstreamRequestWithFaultyFilter) { autonomous_upstream_ = true; } useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -604,8 +602,8 @@ TEST_P(DownstreamProtocolIntegrationTest, FaultyFilterWithConnect) { old_listener->set_name("http_forward"); }); useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -625,8 +623,8 @@ TEST_P(DownstreamProtocolIntegrationTest, FaultyFilterWithConnect) { TEST_P(DownstreamProtocolIntegrationTest, MissingHeadersLocalReply) { useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -646,8 +644,8 @@ TEST_P(DownstreamProtocolIntegrationTest, MissingHeadersLocalReply) { TEST_P(DownstreamProtocolIntegrationTest, MissingHeadersLocalReplyWithBody) { useAccessLog("%RESPONSE_CODE_DETAILS%"); - config_helper_.addFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: invalid-header-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -1180,8 +1178,8 @@ TEST_P(ProtocolIntegrationTest, RetryHittingRouteLimits) { // Test hitting the decoder buffer filter with too many request bytes to buffer. Ensure the // connection manager sends a 413. TEST_P(DownstreamProtocolIntegrationTest, HittingDecoderFilterLimit) { - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.setBufferLimits(1024, 1024); initialize(); @@ -1223,8 +1221,8 @@ TEST_P(ProtocolIntegrationTest, HittingEncoderFilterLimit) { }); useAccessLog(); - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.setBufferLimits(1024, 1024); initialize(); @@ -1863,7 +1861,7 @@ TEST_P(DownstreamProtocolIntegrationTest, MultipleContentLengthsAllowed) { } TEST_P(DownstreamProtocolIntegrationTest, LocalReplyDuringEncoding) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: local-reply-during-encode )EOF"); initialize(); @@ -1887,7 +1885,7 @@ name: local-reply-during-encode } TEST_P(DownstreamProtocolIntegrationTest, LocalReplyDuringEncodingData) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: local-reply-during-encode-data )EOF"); initialize(); @@ -2125,13 +2123,13 @@ TEST_P(ProtocolIntegrationTest, LargeRequestMethod) { // Tests StopAllIterationAndBuffer. Verifies decode-headers-return-stop-all-filter calls decodeData // once after iteration is resumed. TEST_P(DownstreamProtocolIntegrationTest, TestDecodeHeadersReturnsStopAll) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: call-decodedata-once-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: decode-headers-return-stop-all-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: passthrough-filter )EOF"); @@ -2176,10 +2174,10 @@ name: passthrough-filter // Tests StopAllIterationAndWatermark. decode-headers-return-stop-all-watermark-filter sets buffer // limit to 100. Verifies data pause when limit is reached, and resume after iteration continues. TEST_P(DownstreamProtocolIntegrationTest, TestDecodeHeadersReturnsStopAllWatermark) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: decode-headers-return-stop-all-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: passthrough-filter )EOF"); @@ -2234,13 +2232,13 @@ name: passthrough-filter // Test two filters that return StopAllIterationAndBuffer back-to-back. TEST_P(DownstreamProtocolIntegrationTest, TestTwoFiltersDecodeHeadersReturnsStopAll) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: decode-headers-return-stop-all-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: decode-headers-return-stop-all-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: passthrough-filter )EOF"); @@ -2282,7 +2280,7 @@ name: passthrough-filter // Tests encodeHeaders() returns StopAllIterationAndBuffer. TEST_P(DownstreamProtocolIntegrationTest, TestEncodeHeadersReturnsStopAll) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: encode-headers-return-stop-all-filter )EOF"); config_helper_.addConfigModifier( @@ -2316,7 +2314,7 @@ name: encode-headers-return-stop-all-filter // Tests encodeHeaders() returns StopAllIterationAndWatermark. TEST_P(DownstreamProtocolIntegrationTest, TestEncodeHeadersReturnsStopAllWatermark) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: encode-headers-return-stop-all-filter )EOF"); config_helper_.addConfigModifier( @@ -2386,8 +2384,8 @@ TEST_P(ProtocolIntegrationTest, MultipleCookiesAndSetCookies) { // Test that delay closed connections are eventually force closed when the timeout triggers. TEST_P(DownstreamProtocolIntegrationTest, TestDelayedConnectionTeardownTimeoutTrigger) { - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.setBufferLimits(1024, 1024); config_helper_.addConfigModifier( [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& @@ -2730,7 +2728,7 @@ TEST_P(DownstreamProtocolIntegrationTest, HeaderNormalizationRejection) { // Tests a filter that returns a FilterHeadersStatus::Continue after a local reply without // processing new metadata generated in decodeHeader TEST_P(DownstreamProtocolIntegrationTest, LocalReplyWithMetadata) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: local-reply-with-metadata-filter typed_config: "@type": type.googleapis.com/google.protobuf.Empty @@ -2807,7 +2805,7 @@ name: remove-response-headers-filter )EOF"; TEST_P(ProtocolIntegrationTest, HeadersOnlyRequestWithRemoveResponseHeadersFilter) { - config_helper_.addFilter(remove_response_headers_filter); + config_helper_.prependFilter(remove_response_headers_filter); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -2824,7 +2822,7 @@ TEST_P(ProtocolIntegrationTest, HeadersOnlyRequestWithRemoveResponseHeadersFilte } TEST_P(ProtocolIntegrationTest, RemoveResponseHeadersFilter) { - config_helper_.addFilter(remove_response_headers_filter); + config_helper_.prependFilter(remove_response_headers_filter); initialize(); codec_client_ = makeHttpConnection(lookupPort("http")); @@ -2866,14 +2864,14 @@ TEST_P(ProtocolIntegrationTest, ReqRespSizeStats) { // filter chain is aborted and 500 is sent to the client. TEST_P(ProtocolIntegrationTest, OverflowEncoderBufferFromEncodeHeaders) { config_helper_.setBufferLimits(64 * 1024, 64 * 1024); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter typed_config: "@type": type.googleapis.com/test.integration.filters.AddBodyFilterConfig where_to_add_body: ENCODE_HEADERS body_size: 70000 )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig @@ -2898,10 +2896,10 @@ TEST_P(ProtocolIntegrationTest, OverflowEncoderBufferFromEncodeDataWithResponseH config_helper_.setBufferLimits(64 * 1024, 64 * 1024); // Buffer filter will stop iteration from encodeHeaders preventing response headers from being // sent downstream. - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: encoder-decoder-buffer-filter )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig @@ -2930,7 +2928,7 @@ TEST_P(ProtocolIntegrationTest, OverflowEncoderBufferFromEncodeDataWithResponseH TEST_P(ProtocolIntegrationTest, OverflowEncoderBufferFromEncodeData) { config_helper_.setBufferLimits(64 * 1024, 64 * 1024); // Make the add-body-filter stop iteration from encodeData. Headers should be sent to the client. - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter typed_config: "@type": type.googleapis.com/test.integration.filters.AddBodyFilterConfig @@ -2938,7 +2936,7 @@ TEST_P(ProtocolIntegrationTest, OverflowEncoderBufferFromEncodeData) { where_to_stop_and_buffer: ENCODE_DATA body_size: 16384 )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig @@ -2965,13 +2963,13 @@ TEST_P(ProtocolIntegrationTest, OverflowEncoderBufferFromEncodeData) { // filter chain is aborted and 413 is sent to the client. TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeHeaders) { config_helper_.setBufferLimits(64 * 1024, 64 * 1024); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig crash_in_decode_headers: true )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter typed_config: "@type": type.googleapis.com/test.integration.filters.AddBodyFilterConfig @@ -2991,7 +2989,7 @@ TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeHeaders // filter chain is aborted and 413 is sent to the client. TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeData) { config_helper_.setBufferLimits(64 * 1024, 64 * 1024); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig @@ -2999,7 +2997,7 @@ TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeData) { crash_in_decode_data: true )EOF"); // Buffer filter causes filter manager to buffer data - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: encoder-decoder-buffer-filter )EOF"); initialize(); @@ -3027,21 +3025,21 @@ TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeData) { // manager's internal state is slightly different. TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeDataContinueIteration) { config_helper_.setBufferLimits(64 * 1024, 64 * 1024); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig crash_in_decode_headers: false crash_in_decode_data: true )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter typed_config: "@type": type.googleapis.com/test.integration.filters.AddBodyFilterConfig where_to_add_body: DECODE_DATA body_size: 70000 )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: encoder-decoder-buffer-filter )EOF"); initialize(); @@ -3073,7 +3071,7 @@ TEST_P(DownstreamProtocolIntegrationTest, return; } config_helper_.setBufferLimits(64 * 1024, 64 * 1024); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter typed_config: "@type": type.googleapis.com/test.integration.filters.AddBodyFilterConfig @@ -3112,7 +3110,7 @@ TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeTrailer return; } config_helper_.setBufferLimits(64 * 1024, 64 * 1024); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: crash-filter typed_config: "@type": type.googleapis.com/test.integration.filters.CrashFilterConfig @@ -3120,7 +3118,7 @@ TEST_P(DownstreamProtocolIntegrationTest, OverflowDecoderBufferFromDecodeTrailer crash_in_decode_data: true crash_in_decode_trailers: true )EOF"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: add-body-filter typed_config: "@type": type.googleapis.com/test.integration.filters.AddBodyFilterConfig diff --git a/test/integration/redirect_integration_test.cc b/test/integration/redirect_integration_test.cc index ff48c8922b704..6c9f983438f28 100644 --- a/test/integration/redirect_integration_test.cc +++ b/test/integration/redirect_integration_test.cc @@ -535,7 +535,7 @@ TEST_P(RedirectIntegrationTest, InternalRedirectToDestinationWithResponseBody) { config_helper_.addConfigModifier( [](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& hcm) { hcm.set_via("via_value"); }); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: pause-filter typed_config: "@type": type.googleapis.com/google.protobuf.Empty diff --git a/test/integration/scoped_rds_integration_test.cc b/test/integration/scoped_rds_integration_test.cc index c1a96010e6c57..b76a18cda3b37 100644 --- a/test/integration/scoped_rds_integration_test.cc +++ b/test/integration/scoped_rds_integration_test.cc @@ -648,7 +648,7 @@ route_configuration_name: foo_route1 // Test that a scoped route config update is performed on demand and http request will succeed. TEST_P(ScopedRdsIntegrationTest, OnDemandUpdateSuccess) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.on_demand )EOF"); const std::string scope_route1 = R"EOF( @@ -700,7 +700,7 @@ on_demand: true // With on demand update filter configured, scope not match should still return 404 TEST_P(ScopedRdsIntegrationTest, OnDemandUpdateScopeNotMatch) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.on_demand )EOF"); @@ -750,7 +750,7 @@ route_configuration_name: {} // return 404 TEST_P(ScopedRdsIntegrationTest, OnDemandUpdatePrimaryVirtualHostNotMatch) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.on_demand )EOF"); @@ -800,7 +800,7 @@ route_configuration_name: {} // return 404 TEST_P(ScopedRdsIntegrationTest, OnDemandUpdateVirtualHostNotMatch) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.on_demand )EOF"); @@ -854,7 +854,7 @@ on_demand: true // Eager and lazy scopes share the same route configuration TEST_P(ScopedRdsIntegrationTest, DifferentPriorityScopeShareRoute) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.on_demand )EOF"); @@ -910,7 +910,7 @@ on_demand: true } TEST_P(ScopedRdsIntegrationTest, OnDemandUpdateAfterActiveStreamDestroyed) { - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.on_demand )EOF"); const std::string scope_route1 = R"EOF( diff --git a/test/integration/sds_generic_secret_integration_test.cc b/test/integration/sds_generic_secret_integration_test.cc index 5d9c64c921b2b..629213397112a 100644 --- a/test/integration/sds_generic_secret_integration_test.cc +++ b/test/integration/sds_generic_secret_integration_test.cc @@ -101,7 +101,7 @@ class SdsGenericSecretIntegrationTest : public Grpc::GrpcClientIntegrationParamT ConfigHelper::setHttp2(*sds_cluster); }); - config_helper_.addFilter("{ name: sds-generic-secret-test }"); + config_helper_.prependFilter("{ name: sds-generic-secret-test }"); create_xds_upstream_ = true; HttpIntegrationTest::initialize(); diff --git a/test/integration/version_integration_test.cc b/test/integration/version_integration_test.cc index 2ee09525e7519..a4362b80e5595 100644 --- a/test/integration/version_integration_test.cc +++ b/test/integration/version_integration_test.cc @@ -26,25 +26,25 @@ const char ExampleIpTaggingConfig[] = R"EOF( // envoy.filters.http.ip_tagging from v3 TypedStruct config. TEST_P(VersionIntegrationTest, IpTaggingV3StaticTypedStructConfig) { - config_helper_.addFilter(absl::StrCat(R"EOF( + config_helper_.prependFilter(absl::StrCat(R"EOF( name: ip_tagging typed_config: "@type": type.googleapis.com/udpa.type.v1.TypedStruct type_url: type.googleapis.com/envoy.extensions.filters.http.ip_tagging.v3.IPTagging value: )EOF", - ExampleIpTaggingConfig)); + ExampleIpTaggingConfig)); initialize(); } // envoy.filters.http.ip_tagging from v3 typed Any config. TEST_P(VersionIntegrationTest, IpTaggingV3StaticTypedConfig) { - config_helper_.addFilter(absl::StrCat(R"EOF( + config_helper_.prependFilter(absl::StrCat(R"EOF( name: ip_tagging typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.ip_tagging.v3.IPTagging )EOF", - ExampleIpTaggingConfig)); + ExampleIpTaggingConfig)); initialize(); } diff --git a/test/integration/websocket_integration_test.cc b/test/integration/websocket_integration_test.cc index c7159200ab9e0..1ac084679cd4f 100644 --- a/test/integration/websocket_integration_test.cc +++ b/test/integration/websocket_integration_test.cc @@ -350,7 +350,7 @@ TEST_P(WebsocketIntegrationTest, WebsocketCustomFilterChain) { // Add a small buffer filter to the standard HTTP filter chain. Websocket // upgrades will use the HTTP filter chain so will also have small buffers. - config_helper_.addFilter(ConfigHelper::smallBufferFilter()); + config_helper_.prependFilter(ConfigHelper::smallBufferFilter()); // Add a second upgrade type which goes directly to the router filter. config_helper_.addConfigModifier( From ded64ceb665f0f3eb9f7b40160044a11aa6f9186 Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Thu, 9 Sep 2021 19:46:22 -0400 Subject: [PATCH 2/7] Fix & missing spots Signed-off-by: Raul Gutierrez Segales --- test/config/utility.cc | 2 +- test/integration/multiplexed_integration_test.cc | 10 +++++----- test/integration/multiplexed_integration_test.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/config/utility.cc b/test/config/utility.cc index 4c39561331fa1..f344efce69893 100644 --- a/test/config/utility.cc +++ b/test/config/utility.cc @@ -1037,7 +1037,7 @@ void ConfigHelper::addVirtualHost(const envoy::config::route::v3::VirtualHost& v storeHttpConnectionManager(hcm_config); } -void ConfigHelper::addFilter(const std::string& config) { +void ConfigHelper::prependFilter(const std::string& config) { RELEASE_ASSERT(!finalized_, ""); envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager hcm_config; diff --git a/test/integration/multiplexed_integration_test.cc b/test/integration/multiplexed_integration_test.cc index 77584bafc2ee4..0357402a6993a 100644 --- a/test/integration/multiplexed_integration_test.cc +++ b/test/integration/multiplexed_integration_test.cc @@ -408,7 +408,7 @@ void verifyExpectedMetadata(Http::MetadataMap metadata_map, std::set void { hcm.set_proxy_100_continue(true); }); @@ -652,7 +652,7 @@ name: request-metadata-filter )EOF"; TEST_P(Http2MetadataIntegrationTest, ConsumeAndInsertRequestMetadata) { - addFilters({request_metadata_filter}); + prependFilters({request_metadata_filter}); config_helper_.addConfigModifier( [&](envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager& hcm) -> void { hcm.set_proxy_100_continue(true); }); @@ -799,7 +799,7 @@ void Http2MetadataIntegrationTest::verifyHeadersOnlyTest() { } TEST_P(Http2MetadataIntegrationTest, HeadersOnlyRequestWithRequestMetadata) { - addFilters({request_metadata_filter}); + prependFilters({request_metadata_filter}); // Send a headers only request. runHeaderOnlyTest(false, 0); verifyHeadersOnlyTest(); @@ -842,12 +842,12 @@ name: metadata-stop-all-filter )EOF"; TEST_P(Http2MetadataIntegrationTest, RequestMetadataWithStopAllFilterBeforeMetadataFilter) { - addFilters({request_metadata_filter, metadata_stop_all_filter}); + prependFilters({request_metadata_filter, metadata_stop_all_filter}); testRequestMetadataWithStopAllFilter(); } TEST_P(Http2MetadataIntegrationTest, RequestMetadataWithStopAllFilterAfterMetadataFilter) { - addFilters({metadata_stop_all_filter, request_metadata_filter}); + prependFilters({metadata_stop_all_filter, request_metadata_filter}); testRequestMetadataWithStopAllFilter(); } diff --git a/test/integration/multiplexed_integration_test.h b/test/integration/multiplexed_integration_test.h index 0c059d1b41f00..01e7ca1eb9272 100644 --- a/test/integration/multiplexed_integration_test.h +++ b/test/integration/multiplexed_integration_test.h @@ -16,8 +16,8 @@ class Http2IntegrationTest : public HttpProtocolIntegrationTest { void simultaneousRequest(int32_t request1_bytes, int32_t request2_bytes); protected: - // Utility function to add filters. - void addFilters(std::vector filters) { + // Utility function to prepend filters. + void prependFilters(std::vector filters) { for (const auto& filter : filters) { config_helper_.prependFilter(filter); } From ebb875048c11239bef89739c70dfc6b74175ce17 Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Thu, 9 Sep 2021 21:29:54 -0400 Subject: [PATCH 3/7] Fix Signed-off-by: Raul Gutierrez Segales --- test/extensions/filters/http/tap/tap_filter_integration_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/extensions/filters/http/tap/tap_filter_integration_test.cc b/test/extensions/filters/http/tap/tap_filter_integration_test.cc index cb60fb318f8ad..cfd7f764453f5 100644 --- a/test/extensions/filters/http/tap/tap_filter_integration_test.cc +++ b/test/extensions/filters/http/tap/tap_filter_integration_test.cc @@ -369,7 +369,7 @@ config_id: test_config_id ConfigHelper new_config_helper( version_, *api_, MessageUtil::getJsonStringFromMessageOrDie(config_helper_.bootstrap())); - new_config_helper.addFilter(admin_filter_config_); + new_config_helper.prependFilter(admin_filter_config_); new_config_helper.renameListener("foo"); new_config_helper.setLds("1"); test_server_->waitForCounterGe("listener_manager.listener_create_success", 2); From ed7b14e9ebc36cf66e0cac6d965563a84d7f025a Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Fri, 10 Sep 2021 10:43:43 -0400 Subject: [PATCH 4/7] Fix contrib/ & improve comment Signed-off-by: Raul Gutierrez Segales --- .../squash/filters/http/test/squash_filter_integration_test.cc | 2 +- test/integration/multiplexed_integration_test.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/squash/filters/http/test/squash_filter_integration_test.cc b/contrib/squash/filters/http/test/squash_filter_integration_test.cc index 83f10a7069c66..938d2e6a59d40 100644 --- a/contrib/squash/filters/http/test/squash_filter_integration_test.cc +++ b/contrib/squash/filters/http/test/squash_filter_integration_test.cc @@ -82,7 +82,7 @@ class SquashFilterIntegrationTest : public testing::TestWithParamadd_clusters(); diff --git a/test/integration/multiplexed_integration_test.h b/test/integration/multiplexed_integration_test.h index 01e7ca1eb9272..81876304b44c6 100644 --- a/test/integration/multiplexed_integration_test.h +++ b/test/integration/multiplexed_integration_test.h @@ -16,7 +16,8 @@ class Http2IntegrationTest : public HttpProtocolIntegrationTest { void simultaneousRequest(int32_t request1_bytes, int32_t request2_bytes); protected: - // Utility function to prepend filters. + // Utility function to prepend filters. Note that the filters + // are added in reverse order. void prependFilters(std::vector filters) { for (const auto& filter : filters) { config_helper_.prependFilter(filter); From a39646aacceb6e3d8b3336893753e1caf250a146 Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Fri, 10 Sep 2021 13:29:17 -0400 Subject: [PATCH 5/7] Temporarily add addFilter() back We can remove it after this lands and the envoy-filter-example repo is updated, since we can't update both repos atomically. Signed-off-by: Raul Gutierrez Segales --- test/config/utility.cc | 2 ++ test/config/utility.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/test/config/utility.cc b/test/config/utility.cc index f344efce69893..0928efd680b86 100644 --- a/test/config/utility.cc +++ b/test/config/utility.cc @@ -1037,6 +1037,8 @@ void ConfigHelper::addVirtualHost(const envoy::config::route::v3::VirtualHost& v storeHttpConnectionManager(hcm_config); } +void ConfigHelper::addFilter(const std::string& config) { prependFilter(config); } + void ConfigHelper::prependFilter(const std::string& config) { RELEASE_ASSERT(!finalized_, ""); envoy::extensions::filters::network::http_connection_manager::v3::HttpConnectionManager diff --git a/test/config/utility.h b/test/config/utility.h index 2fa8ee4b516d5..f421c95ba8c10 100644 --- a/test/config/utility.h +++ b/test/config/utility.h @@ -215,6 +215,10 @@ class ConfigHelper { // Add an HTTP filter prior to existing filters. void prependFilter(const std::string& filter_yaml); + // Add an HTTP filter prior to existing filters. + // TODO(rgs1): remove once envoy-filter-example has been updated. + void addFilter(const std::string& filter_yaml); + // Add a network filter prior to existing filters. void addNetworkFilter(const std::string& filter_yaml); From 1a51b10ce67466e3cbd9faa5d1e723795ca97149 Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Fri, 10 Sep 2021 13:31:17 -0400 Subject: [PATCH 6/7] Update decompressor filter integ test Signed-off-by: Raul Gutierrez Segales --- .../decompressor/decompressor_filter_integration_test.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 cafb9def8ba8c..137381dc4562f 100644 --- a/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc +++ b/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc @@ -288,12 +288,11 @@ TEST_P(DecompressorIntegrationTest, BidirectionalDecompressionError) { // Buffer the request after it's been decompressed. TEST_P(DecompressorIntegrationTest, DecompressAndBuffer) { - // filters are prepended, so add them in reverse order - config_helper_.addFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " + config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " "type.googleapis.com/google.protobuf.Empty } }"); - config_helper_.addFilter(R"EOF( + config_helper_.prependFilter(R"EOF( name: envoy.filters.http.decompressor typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.decompressor.v3.Decompressor From 51d26d15aea9ad1ace4e181fae0d716b688791fe Mon Sep 17 00:00:00 2001 From: Raul Gutierrez Segales Date: Fri, 10 Sep 2021 13:56:41 -0400 Subject: [PATCH 7/7] Fix format Signed-off-by: Raul Gutierrez Segales --- .../http/decompressor/decompressor_filter_integration_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 137381dc4562f..2aa2cf3d9a342 100644 --- a/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc +++ b/test/extensions/filters/http/decompressor/decompressor_filter_integration_test.cc @@ -290,7 +290,7 @@ TEST_P(DecompressorIntegrationTest, BidirectionalDecompressionError) { TEST_P(DecompressorIntegrationTest, DecompressAndBuffer) { config_helper_.prependFilter("{ name: encoder-decoder-buffer-filter, typed_config: { \"@type\": " - "type.googleapis.com/google.protobuf.Empty } }"); + "type.googleapis.com/google.protobuf.Empty } }"); config_helper_.prependFilter(R"EOF( name: envoy.filters.http.decompressor