diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index 3954d2492177d..a244d8be7a94d 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -432,6 +432,7 @@ def envoy_cc_test_library( deps = deps + [envoy_external_dep_path(dep) for dep in external_deps] + [ envoy_external_dep_path("googletest"), repository + "//test/test_common:printers_includes", + repository + "//test/test_common:test_base", ], tags = tags, alwayslink = 1, diff --git a/test/common/access_log/access_log_formatter_test.cc b/test/common/access_log/access_log_formatter_test.cc index 06273f2fe486d..38a81cd2c6d3f 100644 --- a/test/common/access_log/access_log_formatter_test.cc +++ b/test/common/access_log/access_log_formatter_test.cc @@ -11,10 +11,10 @@ #include "test/mocks/stream_info/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Const; diff --git a/test/common/access_log/access_log_impl_test.cc b/test/common/access_log/access_log_impl_test.cc index f41b113d5c308..6ff26f5d100af 100644 --- a/test/common/access_log/access_log_impl_test.cc +++ b/test/common/access_log/access_log_impl_test.cc @@ -20,10 +20,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -48,7 +48,7 @@ envoy::config::filter::accesslog::v2::AccessLog parseAccessLogFromV2Yaml(const s return access_log; } -class AccessLogImplTest : public testing::Test { +class AccessLogImplTest : public TestBase { public: AccessLogImplTest() : file_(new Filesystem::MockFile()) { ON_CALL(context_, runtime()).WillByDefault(ReturnRef(runtime_)); diff --git a/test/common/access_log/access_log_manager_impl_test.cc b/test/common/access_log/access_log_manager_impl_test.cc index 06838ee9df287..cde2c1a0fb8fc 100644 --- a/test/common/access_log/access_log_manager_impl_test.cc +++ b/test/common/access_log/access_log_manager_impl_test.cc @@ -7,9 +7,9 @@ #include "test/mocks/api/mocks.h" #include "test/mocks/event/mocks.h" #include "test/mocks/filesystem/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; diff --git a/test/common/buffer/buffer_test.cc b/test/common/buffer/buffer_test.cc index c70ea116bdfbc..f9574b5ecc66f 100644 --- a/test/common/buffer/buffer_test.cc +++ b/test/common/buffer/buffer_test.cc @@ -6,10 +6,9 @@ #include "test/common/buffer/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Buffer { namespace { diff --git a/test/common/buffer/owned_impl_test.cc b/test/common/buffer/owned_impl_test.cc index 227f932846620..aad9ada564907 100644 --- a/test/common/buffer/owned_impl_test.cc +++ b/test/common/buffer/owned_impl_test.cc @@ -2,11 +2,11 @@ #include "common/buffer/buffer_impl.h" #include "test/mocks/api/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "absl/strings/str_cat.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; @@ -15,7 +15,7 @@ namespace Envoy { namespace Buffer { namespace { -class OwnedImplTest : public testing::Test { +class OwnedImplTest : public TestBase { public: OwnedImplTest() {} diff --git a/test/common/buffer/utility.h b/test/common/buffer/utility.h index 868427de465ad..1670a2da040ea 100644 --- a/test/common/buffer/utility.h +++ b/test/common/buffer/utility.h @@ -4,7 +4,7 @@ #include "common/buffer/buffer_impl.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Buffer { diff --git a/test/common/buffer/watermark_buffer_test.cc b/test/common/buffer/watermark_buffer_test.cc index e7f45ea56b8f3..18efc42460822 100644 --- a/test/common/buffer/watermark_buffer_test.cc +++ b/test/common/buffer/watermark_buffer_test.cc @@ -3,7 +3,7 @@ #include "common/buffer/buffer_impl.h" #include "common/buffer/watermark_buffer.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Buffer { @@ -11,7 +11,7 @@ namespace { const char TEN_BYTES[] = "0123456789"; -class WatermarkBufferTest : public testing::Test { +class WatermarkBufferTest : public TestBase { public: WatermarkBufferTest() { buffer_.setWatermarks(5, 10); } diff --git a/test/common/buffer/zero_copy_input_stream_test.cc b/test/common/buffer/zero_copy_input_stream_test.cc index 69070f1cc0262..1a748fe1146b6 100644 --- a/test/common/buffer/zero_copy_input_stream_test.cc +++ b/test/common/buffer/zero_copy_input_stream_test.cc @@ -1,13 +1,13 @@ #include "common/buffer/buffer_impl.h" #include "common/buffer/zero_copy_input_stream_impl.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Buffer { namespace { -class ZeroCopyInputStreamTest : public testing::Test { +class ZeroCopyInputStreamTest : public TestBase { public: ZeroCopyInputStreamTest() { Buffer::OwnedImpl buffer{"abcd"}; diff --git a/test/common/common/assert_test.cc b/test/common/common/assert_test.cc index 44d65b4957666..078e085144b63 100644 --- a/test/common/common/assert_test.cc +++ b/test/common/common/assert_test.cc @@ -1,8 +1,7 @@ #include "common/common/assert.h" #include "test/test_common/logging.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/common/common/backoff_strategy_test.cc b/test/common/common/backoff_strategy_test.cc index 010768349983d..3396c166a1ad2 100644 --- a/test/common/common/backoff_strategy_test.cc +++ b/test/common/common/backoff_strategy_test.cc @@ -1,8 +1,7 @@ #include "common/common/backoff_strategy.h" #include "test/mocks/runtime/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::NiceMock; using testing::Return; diff --git a/test/common/common/base64_test.cc b/test/common/common/base64_test.cc index 74cbbd44132cf..257ad00603260 100644 --- a/test/common/common/base64_test.cc +++ b/test/common/common/base64_test.cc @@ -4,8 +4,7 @@ #include "common/common/base64.h" #include "test/test_common/printers.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { TEST(Base64Test, EmptyBufferEncode) { diff --git a/test/common/common/block_memory_hash_set_test.cc b/test/common/common/block_memory_hash_set_test.cc index 37b4957feca1f..fbeb56f7c38d9 100644 --- a/test/common/common/block_memory_hash_set_test.cc +++ b/test/common/common/block_memory_hash_set_test.cc @@ -9,13 +9,14 @@ #include "common/common/hash.h" #include "common/stats/stats_options_impl.h" +#include "test/test_common/test_base.h" + #include "absl/strings/string_view.h" -#include "gtest/gtest.h" namespace Envoy { // Tests BlockMemoryHashSet. -class BlockMemoryHashSetTest : public testing::Test { +class BlockMemoryHashSetTest : public TestBase { protected: // TestValue that doesn't define a hash. struct TestValueBase { diff --git a/test/common/common/callback_impl_test.cc b/test/common/common/callback_impl_test.cc index 6f5d6afe48545..72ea44c63b81e 100644 --- a/test/common/common/callback_impl_test.cc +++ b/test/common/common/callback_impl_test.cc @@ -1,5 +1,7 @@ #include "common/common/callback_impl.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" using testing::InSequence; @@ -7,7 +9,7 @@ using testing::InSequence; namespace Envoy { namespace Common { -class CallbackManagerTest : public testing::Test { +class CallbackManagerTest : public TestBase { public: MOCK_METHOD1(called, void(int arg)); }; diff --git a/test/common/common/cleanup_test.cc b/test/common/common/cleanup_test.cc index 742f279dc530c..f702f70f4bdc9 100644 --- a/test/common/common/cleanup_test.cc +++ b/test/common/common/cleanup_test.cc @@ -1,6 +1,6 @@ #include "common/common/cleanup.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/common/common/fmt_test.cc b/test/common/common/fmt_test.cc index f5b8fd45d9536..6ec59c26b2701 100644 --- a/test/common/common/fmt_test.cc +++ b/test/common/common/fmt_test.cc @@ -1,8 +1,9 @@ #include "common/common/fmt.h" #include "common/common/logger.h" +#include "test/test_common/test_base.h" + #include "absl/strings/string_view.h" -#include "gtest/gtest.h" namespace Envoy { diff --git a/test/common/common/hash_test.cc b/test/common/common/hash_test.cc index e1fcafc5ea971..8d131ea7ca9ff 100644 --- a/test/common/common/hash_test.cc +++ b/test/common/common/hash_test.cc @@ -1,6 +1,6 @@ #include "common/common/hash.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { TEST(Hash, xxHash) { diff --git a/test/common/common/hex_test.cc b/test/common/common/hex_test.cc index 06a06469edc1c..4fe426a25fb93 100644 --- a/test/common/common/hex_test.cc +++ b/test/common/common/hex_test.cc @@ -5,7 +5,7 @@ #include "common/common/hex.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { TEST(Hex, SimpleEncode) { diff --git a/test/common/common/lock_guard_test.cc b/test/common/common/lock_guard_test.cc index 55f505f9ab584..ee9073391a5d5 100644 --- a/test/common/common/lock_guard_test.cc +++ b/test/common/common/lock_guard_test.cc @@ -1,12 +1,12 @@ #include "common/common/lock_guard.h" #include "common/common/thread.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Thread { -class ThreadTest : public testing::Test { +class ThreadTest : public TestBase { protected: ThreadTest() : a_(0), b_(0) {} int a_ GUARDED_BY(a_mutex_); diff --git a/test/common/common/log_macros_test.cc b/test/common/common/log_macros_test.cc index 8d683910bb6b7..82fdfeca05ec2 100644 --- a/test/common/common/log_macros_test.cc +++ b/test/common/common/log_macros_test.cc @@ -5,9 +5,9 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/network/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { diff --git a/test/common/common/matchers_test.cc b/test/common/common/matchers_test.cc index d5b509a89082a..43c24e132109c 100644 --- a/test/common/common/matchers_test.cc +++ b/test/common/common/matchers_test.cc @@ -7,7 +7,7 @@ #include "common/config/metadata.h" #include "common/protobuf/protobuf.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Matcher { diff --git a/test/common/common/mutex_tracer_test.cc b/test/common/common/mutex_tracer_test.cc index 042b0469f1994..a8ccee205a047 100644 --- a/test/common/common/mutex_tracer_test.cc +++ b/test/common/common/mutex_tracer_test.cc @@ -5,13 +5,13 @@ #include "common/common/mutex_tracer_impl.h" #include "test/test_common/contention.h" +#include "test/test_common/test_base.h" #include "absl/synchronization/mutex.h" -#include "gtest/gtest.h" namespace Envoy { -class MutexTracerTest : public testing::Test { +class MutexTracerTest : public TestBase { protected: void SetUp() override { tracer_.reset(); } diff --git a/test/common/common/perf_annotation_disabled_test.cc b/test/common/common/perf_annotation_disabled_test.cc index 8109cad634578..fe6ecc663a2b2 100644 --- a/test/common/common/perf_annotation_disabled_test.cc +++ b/test/common/common/perf_annotation_disabled_test.cc @@ -6,7 +6,7 @@ #include "common/common/perf_annotation.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/common/common/perf_annotation_test.cc b/test/common/common/perf_annotation_test.cc index c8498a72096ef..6a479009b25f0 100644 --- a/test/common/common/perf_annotation_test.cc +++ b/test/common/common/perf_annotation_test.cc @@ -9,11 +9,11 @@ #include "common/common/perf_annotation.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { -class PerfAnnotationTest : public testing::Test { +class PerfAnnotationTest : public TestBase { protected: void TearDown() override { PERF_CLEAR(); } }; diff --git a/test/common/common/phantom_test.cc b/test/common/common/phantom_test.cc index 6ec0ed1850683..fbdfd42a5df0c 100644 --- a/test/common/common/phantom_test.cc +++ b/test/common/common/phantom_test.cc @@ -1,6 +1,6 @@ #include "common/common/phantom.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/common/common/stack_array_test.cc b/test/common/common/stack_array_test.cc index fa857f77b05f5..04a98c9d31596 100644 --- a/test/common/common/stack_array_test.cc +++ b/test/common/common/stack_array_test.cc @@ -1,7 +1,8 @@ #include "common/common/stack_array.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { diff --git a/test/common/common/to_lower_table_test.cc b/test/common/common/to_lower_table_test.cc index 3004f852aa200..a20c6cebdd5a4 100644 --- a/test/common/common/to_lower_table_test.cc +++ b/test/common/common/to_lower_table_test.cc @@ -1,6 +1,6 @@ #include "common/common/to_lower_table.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { TEST(ToLowerTableTest, All) { diff --git a/test/common/common/token_bucket_impl_test.cc b/test/common/common/token_bucket_impl_test.cc index 5d4e811e473e8..5d575377769d1 100644 --- a/test/common/common/token_bucket_impl_test.cc +++ b/test/common/common/token_bucket_impl_test.cc @@ -3,12 +3,11 @@ #include "common/common/token_bucket_impl.h" #include "test/test_common/simulated_time_system.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { -class TokenBucketImplTest : public testing::Test { +class TokenBucketImplTest : public TestBase { protected: Event::SimulatedTimeSystem time_system_; }; diff --git a/test/common/common/utility_test.cc b/test/common/common/utility_test.cc index 2946b52189103..3e83544a04c00 100644 --- a/test/common/common/utility_test.cc +++ b/test/common/common/utility_test.cc @@ -8,13 +8,13 @@ #include "common/common/utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::ContainerEq; diff --git a/test/common/compressor/zlib_compressor_impl_test.cc b/test/common/compressor/zlib_compressor_impl_test.cc index 8d07331995a1e..c1fd72b5cd50d 100644 --- a/test/common/compressor/zlib_compressor_impl_test.cc +++ b/test/common/compressor/zlib_compressor_impl_test.cc @@ -3,15 +3,14 @@ #include "common/common/stack_array.h" #include "common/compressor/zlib_compressor_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Compressor { namespace { -class ZlibCompressorImplTest : public testing::Test { +class ZlibCompressorImplTest : public TestBase { protected: void expectValidFlushedBuffer(const Buffer::OwnedImpl& output_buffer) { uint64_t num_comp_slices = output_buffer.getRawSlices(nullptr, 0); diff --git a/test/common/config/config_provider_impl_test.cc b/test/common/config/config_provider_impl_test.cc index 4704f1aa82b06..1f355769cda58 100644 --- a/test/common/config/config_provider_impl_test.cc +++ b/test/common/config/config_provider_impl_test.cc @@ -6,9 +6,9 @@ #include "test/common/config/dummy_config.pb.h" #include "test/mocks/server/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Config { @@ -205,7 +205,7 @@ DummyConfigSubscription::DummyConfigSubscription( "DummyDS", manager_identifier, config_provider_manager, factory_context.timeSource(), factory_context.timeSource().systemTime(), factory_context.localInfo()) {} -class ConfigProviderImplTest : public testing::Test { +class ConfigProviderImplTest : public TestBase { public: ConfigProviderImplTest() { EXPECT_CALL(factory_context_.admin_.config_tracker_, add_("dummy", _)); diff --git a/test/common/config/filesystem_subscription_impl_test.cc b/test/common/config/filesystem_subscription_impl_test.cc index b76d6de62a7b6..c1582b0f45574 100644 --- a/test/common/config/filesystem_subscription_impl_test.cc +++ b/test/common/config/filesystem_subscription_impl_test.cc @@ -2,9 +2,9 @@ #include "test/mocks/event/mocks.h" #include "test/mocks/filesystem/mocks.h" #include "test/test_common/logging.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using ::testing::Throw; @@ -12,8 +12,7 @@ namespace Envoy { namespace Config { namespace { -class FilesystemSubscriptionImplTest : public FilesystemSubscriptionTestHarness, - public testing::Test {}; +class FilesystemSubscriptionImplTest : public FilesystemSubscriptionTestHarness, public TestBase {}; // Validate that the client can recover from bad JSON responses. TEST_F(FilesystemSubscriptionImplTest, BadJsonRecovery) { diff --git a/test/common/config/filesystem_subscription_test_harness.h b/test/common/config/filesystem_subscription_test_harness.h index ef402e6573448..f78b0ef199d55 100644 --- a/test/common/config/filesystem_subscription_test_harness.h +++ b/test/common/config/filesystem_subscription_test_harness.h @@ -11,11 +11,11 @@ #include "test/common/config/subscription_test_harness.h" #include "test/mocks/config/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/common/config/filter_json_test.cc b/test/common/config/filter_json_test.cc index 8cec55f45609a..beb6a7e4de3dd 100644 --- a/test/common/config/filter_json_test.cc +++ b/test/common/config/filter_json_test.cc @@ -5,10 +5,9 @@ #include "common/config/filter_json.h" #include "common/json/json_loader.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Config { namespace { diff --git a/test/common/config/grpc_mux_impl_test.cc b/test/common/config/grpc_mux_impl_test.cc index d20d699fbdec6..b8c58b5443fea 100644 --- a/test/common/config/grpc_mux_impl_test.cc +++ b/test/common/config/grpc_mux_impl_test.cc @@ -18,11 +18,11 @@ #include "test/mocks/runtime/mocks.h" #include "test/test_common/logging.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtLeast; @@ -38,7 +38,7 @@ namespace { // We test some mux specific stuff below, other unit test coverage for singleton use of GrpcMuxImpl // is provided in [grpc_]subscription_impl_test.cc. -class GrpcMuxImplTestBase : public testing::Test { +class GrpcMuxImplTestBase : public TestBase { public: GrpcMuxImplTestBase() : async_client_(new Grpc::MockAsyncClient()) {} diff --git a/test/common/config/grpc_subscription_impl_test.cc b/test/common/config/grpc_subscription_impl_test.cc index 3dd94aea5f4f1..1c2f1c987e87b 100644 --- a/test/common/config/grpc_subscription_impl_test.cc +++ b/test/common/config/grpc_subscription_impl_test.cc @@ -1,6 +1,5 @@ #include "test/common/config/grpc_subscription_test_harness.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::InSequence; @@ -8,7 +7,7 @@ namespace Envoy { namespace Config { namespace { -class GrpcSubscriptionImplTest : public GrpcSubscriptionTestHarness, public testing::Test {}; +class GrpcSubscriptionImplTest : public GrpcSubscriptionTestHarness, public TestBase {}; // Validate that stream creation results in a timer based retry and can recover. TEST_F(GrpcSubscriptionImplTest, StreamCreationFailure) { diff --git a/test/common/config/grpc_subscription_test_harness.h b/test/common/config/grpc_subscription_test_harness.h index c6316aab957ce..a9e2c0eed41db 100644 --- a/test/common/config/grpc_subscription_test_harness.h +++ b/test/common/config/grpc_subscription_test_harness.h @@ -14,10 +14,10 @@ #include "test/mocks/grpc/mocks.h" #include "test/mocks/local_info/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/common/config/http_subscription_impl_test.cc b/test/common/config/http_subscription_impl_test.cc index 8a275347ec0b5..05d5c19cf5cda 100644 --- a/test/common/config/http_subscription_impl_test.cc +++ b/test/common/config/http_subscription_impl_test.cc @@ -1,14 +1,13 @@ #include #include "test/common/config/http_subscription_test_harness.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Config { namespace { -class HttpSubscriptionImplTest : public HttpSubscriptionTestHarness, public testing::Test {}; +class HttpSubscriptionImplTest : public HttpSubscriptionTestHarness, public TestBase {}; // Validate that the client can recover from a remote fetch failure. TEST_F(HttpSubscriptionImplTest, OnRequestReset) { diff --git a/test/common/config/http_subscription_test_harness.h b/test/common/config/http_subscription_test_harness.h index 762f28454b253..d847994b081f2 100644 --- a/test/common/config/http_subscription_test_harness.h +++ b/test/common/config/http_subscription_test_harness.h @@ -17,10 +17,10 @@ #include "test/mocks/local_info/mocks.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/common/config/metadata_test.cc b/test/common/config/metadata_test.cc index 28d5cb67b4a83..bfc208841fcfa 100644 --- a/test/common/config/metadata_test.cc +++ b/test/common/config/metadata_test.cc @@ -5,10 +5,9 @@ #include "common/protobuf/utility.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Config { namespace { @@ -48,7 +47,7 @@ TEST(MetadataTest, MetadataValuePath) { ProtobufWkt::Value::KindCase::KIND_NOT_SET); } -class TypedMetadataTest : public testing::Test { +class TypedMetadataTest : public TestBase { public: TypedMetadataTest() : registered_factory_(foo_factory_) {} diff --git a/test/common/config/rds_json_test.cc b/test/common/config/rds_json_test.cc index 0b099bbe33e38..262871c750b72 100644 --- a/test/common/config/rds_json_test.cc +++ b/test/common/config/rds_json_test.cc @@ -3,8 +3,9 @@ #include "common/config/rds_json.h" #include "common/json/json_loader.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/common/config/subscription_factory_test.cc b/test/common/config/subscription_factory_test.cc index e689f68fc4bfb..0daf82b123fca 100644 --- a/test/common/config/subscription_factory_test.cc +++ b/test/common/config/subscription_factory_test.cc @@ -14,10 +14,10 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using ::testing::_; using ::testing::Invoke; @@ -26,7 +26,7 @@ using ::testing::Return; namespace Envoy { namespace Config { -class SubscriptionFactoryTest : public ::testing::Test { +class SubscriptionFactoryTest : public TestBase { public: SubscriptionFactoryTest() : http_request_(&cm_.async_client_), api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/config/subscription_impl_test.cc b/test/common/config/subscription_impl_test.cc index 85b07333306ae..503f469fe8bb1 100644 --- a/test/common/config/subscription_impl_test.cc +++ b/test/common/config/subscription_impl_test.cc @@ -15,7 +15,7 @@ enum class SubscriptionType { Filesystem, }; -class SubscriptionImplTest : public testing::TestWithParam { +class SubscriptionImplTest : public TestBaseWithParam { public: SubscriptionImplTest() { switch (GetParam()) { diff --git a/test/common/config/subscription_test_harness.h b/test/common/config/subscription_test_harness.h index 0df305a00f581..16d1841217898 100644 --- a/test/common/config/subscription_test_harness.h +++ b/test/common/config/subscription_test_harness.h @@ -3,9 +3,9 @@ #include "common/config/utility.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Config { diff --git a/test/common/config/utility_test.cc b/test/common/config/utility_test.cc index c52d2c8118134..c3ebc97e5d235 100644 --- a/test/common/config/utility_test.cc +++ b/test/common/config/utility_test.cc @@ -14,10 +14,10 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtLeast; diff --git a/test/common/crypto/utility_test.cc b/test/common/crypto/utility_test.cc index 46c6852102441..e3730caab9593 100644 --- a/test/common/crypto/utility_test.cc +++ b/test/common/crypto/utility_test.cc @@ -2,7 +2,7 @@ #include "common/common/hex.h" #include "common/crypto/utility.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Common { diff --git a/test/common/decompressor/zlib_decompressor_impl_test.cc b/test/common/decompressor/zlib_decompressor_impl_test.cc index bb715643e1239..3dfa3600966a4 100644 --- a/test/common/decompressor/zlib_decompressor_impl_test.cc +++ b/test/common/decompressor/zlib_decompressor_impl_test.cc @@ -3,15 +3,14 @@ #include "common/compressor/zlib_compressor_impl.h" #include "common/decompressor/zlib_decompressor_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Decompressor { namespace { -class ZlibDecompressorImplTest : public testing::Test { +class ZlibDecompressorImplTest : public TestBase { protected: void drainBuffer(Buffer::OwnedImpl& buffer) { buffer.drain(buffer.length()); } diff --git a/test/common/event/dispatched_thread_impl_test.cc b/test/common/event/dispatched_thread_impl_test.cc index cf0717371c3a3..1971ee014621a 100644 --- a/test/common/event/dispatched_thread_impl_test.cc +++ b/test/common/event/dispatched_thread_impl_test.cc @@ -9,11 +9,11 @@ #include "test/mocks/common.h" #include "test/mocks/server/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::InSequence; using testing::NiceMock; @@ -21,7 +21,7 @@ using testing::NiceMock; namespace Envoy { namespace Event { -class DispatchedThreadTest : public testing::Test { +class DispatchedThreadTest : public TestBase { protected: DispatchedThreadTest() : config_(1000, 1000, 1000, 1000), api_(Api::createApiForTest(fakestats_)), diff --git a/test/common/event/dispatcher_impl_test.cc b/test/common/event/dispatcher_impl_test.cc index 1d2d6b54a5331..da48fa793e17c 100644 --- a/test/common/event/dispatcher_impl_test.cc +++ b/test/common/event/dispatcher_impl_test.cc @@ -8,11 +8,11 @@ #include "common/stats/isolated_store_impl.h" #include "test/mocks/common.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::InSequence; @@ -61,7 +61,7 @@ TEST(DeferredDeleteTest, DeferredDelete) { dispatcher.clearDeferredDeleteList(); } -class DispatcherImplTest : public ::testing::Test { +class DispatcherImplTest : public TestBase { protected: DispatcherImplTest() : api_(Api::createApiForTest(stat_store_)), diff --git a/test/common/event/file_event_impl_test.cc b/test/common/event/file_event_impl_test.cc index 8b8dc3fe415bc..cb8bec642bf66 100644 --- a/test/common/event/file_event_impl_test.cc +++ b/test/common/event/file_event_impl_test.cc @@ -7,15 +7,14 @@ #include "test/mocks/common.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Event { -class FileEventImplTest : public testing::Test { +class FileEventImplTest : public TestBase { public: FileEventImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(test_time_.timeSystem(), *api_) {} @@ -41,7 +40,7 @@ class FileEventImplTest : public testing::Test { DispatcherImpl dispatcher_; }; -class FileEventImplActivateTest : public testing::TestWithParam {}; +class FileEventImplActivateTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, FileEventImplActivateTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), diff --git a/test/common/filesystem/directory_test.cc b/test/common/filesystem/directory_test.cc index 5536f77d72863..9eb3f0d3ddd73 100644 --- a/test/common/filesystem/directory_test.cc +++ b/test/common/filesystem/directory_test.cc @@ -6,10 +6,10 @@ #include "common/filesystem/directory.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Filesystem { @@ -18,7 +18,7 @@ namespace Filesystem { // as it looks like some versions of libstdc++ have a bug in // std::experimental::filesystem::remove_all where it fails with nested directories: // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71313 -class DirectoryTest : public testing::Test { +class DirectoryTest : public TestBase { public: DirectoryTest() : dir_path_(TestEnvironment::temporaryPath("envoy_test")) { files_to_remove_.push(dir_path_); diff --git a/test/common/filesystem/filesystem_impl_test.cc b/test/common/filesystem/filesystem_impl_test.cc index 4e4558c835919..3bc30c6a14c7c 100644 --- a/test/common/filesystem/filesystem_impl_test.cc +++ b/test/common/filesystem/filesystem_impl_test.cc @@ -13,11 +13,11 @@ #include "test/mocks/event/mocks.h" #include "test/mocks/filesystem/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -30,7 +30,7 @@ using testing::Throw; namespace Envoy { -class FileSystemImplTest : public testing::Test { +class FileSystemImplTest : public TestBase { protected: FileSystemImplTest() : file_system_(std::chrono::milliseconds(10000), Thread::threadFactoryForTest(), diff --git a/test/common/filesystem/watcher_impl_test.cc b/test/common/filesystem/watcher_impl_test.cc index 0f90304f001f7..a7ab6895f702f 100644 --- a/test/common/filesystem/watcher_impl_test.cc +++ b/test/common/filesystem/watcher_impl_test.cc @@ -7,16 +7,16 @@ #include "common/stats/isolated_store_impl.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Filesystem { -class WatcherImplTest : public testing::Test { +class WatcherImplTest : public TestBase { protected: WatcherImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(test_time_.timeSystem(), *api_) {} diff --git a/test/common/grpc/async_client_impl_test.cc b/test/common/grpc/async_client_impl_test.cc index 94a33c83fd683..f12ff49921378 100644 --- a/test/common/grpc/async_client_impl_test.cc +++ b/test/common/grpc/async_client_impl_test.cc @@ -4,10 +4,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/proto/helloworld.pb.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -19,7 +19,7 @@ namespace Envoy { namespace Grpc { namespace { -class EnvoyAsyncClientImplTest : public testing::Test { +class EnvoyAsyncClientImplTest : public TestBase { public: EnvoyAsyncClientImplTest() : method_descriptor_(helloworld::Greeter::descriptor()->FindMethodByName("SayHello")) { diff --git a/test/common/grpc/async_client_manager_impl_test.cc b/test/common/grpc/async_client_manager_impl_test.cc index c047970fc9682..8d3c15f0a9fdc 100644 --- a/test/common/grpc/async_client_manager_impl_test.cc +++ b/test/common/grpc/async_client_manager_impl_test.cc @@ -4,11 +4,11 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using ::testing::Return; @@ -16,7 +16,7 @@ namespace Envoy { namespace Grpc { namespace { -class AsyncClientManagerImplTest : public testing::Test { +class AsyncClientManagerImplTest : public TestBase { public: AsyncClientManagerImplTest() : api_(Api::createApiForTest(api_stats_store_)) {} diff --git a/test/common/grpc/codec_test.cc b/test/common/grpc/codec_test.cc index 99a9d2f599731..e0e6be57502d5 100644 --- a/test/common/grpc/codec_test.cc +++ b/test/common/grpc/codec_test.cc @@ -8,8 +8,7 @@ #include "test/proto/helloworld.pb.h" #include "test/test_common/printers.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Grpc { diff --git a/test/common/grpc/common_test.cc b/test/common/grpc/common_test.cc index 290328a53941a..34a582d35c937 100644 --- a/test/common/grpc/common_test.cc +++ b/test/common/grpc/common_test.cc @@ -5,10 +5,9 @@ #include "test/mocks/upstream/mocks.h" #include "test/proto/helloworld.pb.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Grpc { diff --git a/test/common/grpc/google_async_client_impl_test.cc b/test/common/grpc/google_async_client_impl_test.cc index abbc914c8c687..761ce43fbd61c 100644 --- a/test/common/grpc/google_async_client_impl_test.cc +++ b/test/common/grpc/google_async_client_impl_test.cc @@ -8,11 +8,11 @@ #include "test/mocks/grpc/mocks.h" #include "test/mocks/tracing/mocks.h" #include "test/proto/helloworld.pb.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; @@ -44,7 +44,7 @@ class MockStubFactory : public GoogleStubFactory { std::shared_ptr shared_stub_{stub_}; }; -class EnvoyGoogleAsyncClientImplTest : public testing::Test { +class EnvoyGoogleAsyncClientImplTest : public TestBase { public: EnvoyGoogleAsyncClientImplTest() : stats_store_(new Stats::IsolatedStoreImpl), api_(Api::createApiForTest(*stats_store_)), diff --git a/test/common/grpc/google_grpc_creds_test.cc b/test/common/grpc/google_grpc_creds_test.cc index a9eeb2a550024..1bbb3bd353401 100644 --- a/test/common/grpc/google_grpc_creds_test.cc +++ b/test/common/grpc/google_grpc_creds_test.cc @@ -2,10 +2,9 @@ #include "test/common/grpc/utility.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Grpc { namespace { @@ -15,7 +14,7 @@ namespace { // of getting at the underlying state, we can at best just make sure we don't // crash, compare with nullptr and/or look at vector lengths. -class CredsUtilityTest : public testing::Test { +class CredsUtilityTest : public TestBase { public: CredsUtilityTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/grpc/grpc_client_integration.h b/test/common/grpc/grpc_client_integration.h index a2c1ac2ca3f19..ee664f4f2f599 100644 --- a/test/common/grpc/grpc_client_integration.h +++ b/test/common/grpc/grpc_client_integration.h @@ -2,10 +2,9 @@ #include "common/common/assert.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Grpc { @@ -39,11 +38,11 @@ class BaseGrpcClientIntegrationParamTest { class GrpcClientIntegrationParamTest : public BaseGrpcClientIntegrationParamTest, - public testing::TestWithParam> { + public TestBaseWithParam> { public: ~GrpcClientIntegrationParamTest() {} static std::string protocolTestParamsToString( - const testing::TestParamInfo>& p) { + const ::testing::TestParamInfo>& p) { return absl::StrCat( (std::get<0>(p.param) == Network::Address::IpVersion::v4 ? "IPv4_" : "IPv6_"), (std::get<1>(p.param) == ClientType::GoogleGrpc ? "GoogleGrpc" : "EnvoyGrpc")); diff --git a/test/common/html/utility_test.cc b/test/common/html/utility_test.cc index 251e3508a9cb1..d4954b9bf9a3f 100644 --- a/test/common/html/utility_test.cc +++ b/test/common/html/utility_test.cc @@ -1,6 +1,6 @@ #include "common/html/utility.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Html { diff --git a/test/common/http/async_client_impl_test.cc b/test/common/http/async_client_impl_test.cc index ba6115bedc04d..67f6b1291ea3d 100644 --- a/test/common/http/async_client_impl_test.cc +++ b/test/common/http/async_client_impl_test.cc @@ -19,9 +19,9 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -34,7 +34,7 @@ namespace Envoy { namespace Http { namespace { -class AsyncClientImplTest : public testing::Test { +class AsyncClientImplTest : public TestBase { public: AsyncClientImplTest() : client_(cm_.thread_local_cluster_.cluster_.info_, stats_store_, dispatcher_, local_info_, diff --git a/test/common/http/codec_client_test.cc b/test/common/http/codec_client_test.cc index 2fcddd36f2552..0871311e6fbb1 100644 --- a/test/common/http/codec_client_test.cc +++ b/test/common/http/codec_client_test.cc @@ -18,11 +18,11 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtMost; @@ -38,7 +38,7 @@ using testing::Throw; namespace Envoy { namespace Http { -class CodecClientTest : public testing::Test { +class CodecClientTest : public TestBase { public: CodecClientTest() { connection_ = new NiceMock(); @@ -259,7 +259,7 @@ TEST_F(CodecClientTest, WatermarkPassthrough) { } // Test the codec getting input from a real TCP connection. -class CodecNetworkTest : public testing::TestWithParam { +class CodecNetworkTest : public TestBaseWithParam { public: CodecNetworkTest() : api_(Api::createApiForTest(stats_store_)) { dispatcher_ = std::make_unique(test_time_.timeSystem(), *api_); diff --git a/test/common/http/codes_test.cc b/test/common/http/codes_test.cc index b209d6ce74e32..598bd008f6ff6 100644 --- a/test/common/http/codes_test.cc +++ b/test/common/http/codes_test.cc @@ -11,10 +11,10 @@ #include "test/mocks/stats/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Property; @@ -22,7 +22,7 @@ using testing::Property; namespace Envoy { namespace Http { -class CodeUtilityTest : public testing::Test { +class CodeUtilityTest : public TestBase { public: void addResponse(uint64_t code, bool canary, bool internal_request, const std::string& request_vhost_name = EMPTY_STRING, @@ -235,7 +235,7 @@ TEST(CodeUtilityResponseTimingTest, All) { code_stats.chargeResponseTiming(info); } -class CodeStatsTest : public testing::Test { +class CodeStatsTest : public TestBase { protected: absl::string_view stripTrailingDot(absl::string_view prefix) { return CodeStatsImpl::stripTrailingDot(prefix); diff --git a/test/common/http/conn_manager_impl_test.cc b/test/common/http/conn_manager_impl_test.cc index dd73d03349228..527bb7b86578f 100644 --- a/test/common/http/conn_manager_impl_test.cc +++ b/test/common/http/conn_manager_impl_test.cc @@ -39,10 +39,10 @@ #include "test/mocks/upstream/cluster_info.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -60,7 +60,7 @@ using testing::Sequence; namespace Envoy { namespace Http { -class HttpConnectionManagerImplTest : public testing::Test, public ConnectionManagerConfig { +class HttpConnectionManagerImplTest : public TestBase, public ConnectionManagerConfig { public: struct RouteConfigProvider : public Router::RouteConfigProvider { RouteConfigProvider(TimeSource& time_source) : time_source_(time_source) {} diff --git a/test/common/http/conn_manager_utility_test.cc b/test/common/http/conn_manager_utility_test.cc index 3d9335d96b2e5..6ede90b769f41 100644 --- a/test/common/http/conn_manager_utility_test.cc +++ b/test/common/http/conn_manager_utility_test.cc @@ -13,10 +13,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/ssl/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -82,7 +82,7 @@ class MockConnectionManagerConfig : public ConnectionManagerConfig { std::make_unique(); }; -class ConnectionManagerUtilityTest : public testing::Test { +class ConnectionManagerUtilityTest : public TestBase { public: ConnectionManagerUtilityTest() { ON_CALL(config_, userAgent()).WillByDefault(ReturnRef(user_agent_)); diff --git a/test/common/http/date_provider_impl_test.cc b/test/common/http/date_provider_impl_test.cc index ea037ee0f8d9f..352554cd520e7 100644 --- a/test/common/http/date_provider_impl_test.cc +++ b/test/common/http/date_provider_impl_test.cc @@ -6,9 +6,9 @@ #include "test/mocks/event/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; diff --git a/test/common/http/header_map_impl_test.cc b/test/common/http/header_map_impl_test.cc index c8ffe6d455681..dfdb515af7fd1 100644 --- a/test/common/http/header_map_impl_test.cc +++ b/test/common/http/header_map_impl_test.cc @@ -4,10 +4,9 @@ #include "common/http/header_map_impl.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using ::testing::InSequence; namespace Envoy { diff --git a/test/common/http/header_utility_test.cc b/test/common/http/header_utility_test.cc index 0d8c82d134245..b65439f7de714 100644 --- a/test/common/http/header_utility_test.cc +++ b/test/common/http/header_utility_test.cc @@ -7,10 +7,9 @@ #include "common/http/header_utility.h" #include "common/json/json_loader.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Http { diff --git a/test/common/http/http1/codec_impl_test.cc b/test/common/http/http1/codec_impl_test.cc index 3fcd623377298..74fb6280b8264 100644 --- a/test/common/http/http1/codec_impl_test.cc +++ b/test/common/http/http1/codec_impl_test.cc @@ -13,9 +13,9 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/network/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -28,7 +28,7 @@ namespace Envoy { namespace Http { namespace Http1 { -class Http1ServerConnectionImplTest : public ::testing::Test { +class Http1ServerConnectionImplTest : public TestBase { public: void initialize() { codec_ = std::make_unique(connection_, callbacks_, codec_settings_); @@ -671,7 +671,7 @@ TEST_F(Http1ServerConnectionImplTest, WatermarkTest) { ->onUnderlyingConnectionBelowWriteBufferLowWatermark(); } -class Http1ClientConnectionImplTest : public testing::Test { +class Http1ClientConnectionImplTest : public TestBase { public: void initialize() { codec_ = std::make_unique(connection_, callbacks_); } diff --git a/test/common/http/http1/conn_pool_test.cc b/test/common/http/http1/conn_pool_test.cc index ddcd230d50011..40c3994e9688a 100644 --- a/test/common/http/http1/conn_pool_test.cc +++ b/test/common/http/http1/conn_pool_test.cc @@ -17,11 +17,11 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -124,7 +124,7 @@ class ConnPoolImplForTest : public ConnPoolImpl { /** * Test fixture for all connection pool tests. */ -class Http1ConnPoolImplTest : public testing::Test { +class Http1ConnPoolImplTest : public TestBase { public: Http1ConnPoolImplTest() : upstream_ready_timer_(new NiceMock(&dispatcher_)), diff --git a/test/common/http/http2/codec_impl_test.cc b/test/common/http/http2/codec_impl_test.cc index ea41227ac65e9..a20bfda08d15f 100644 --- a/test/common/http/http2/codec_impl_test.cc +++ b/test/common/http/http2/codec_impl_test.cc @@ -12,10 +12,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/network/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -51,7 +51,7 @@ class TestClientConnectionImpl : public ClientConnectionImpl { using ClientConnectionImpl::getStream; }; -class Http2CodecImplTest : public testing::TestWithParam { +class Http2CodecImplTest : public TestBaseWithParam { public: struct ConnectionWrapper { void dispatch(const Buffer::Instance& data, ConnectionImpl& connection) { diff --git a/test/common/http/http2/conn_pool_test.cc b/test/common/http/http2/conn_pool_test.cc index 9e67df328a16b..0402277c88f00 100644 --- a/test/common/http/http2/conn_pool_test.cc +++ b/test/common/http/http2/conn_pool_test.cc @@ -15,10 +15,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -54,7 +54,7 @@ class TestConnPoolImpl : public ConnPoolImpl { class ActiveTestRequest; -class Http2ConnPoolImplTest : public testing::Test { +class Http2ConnPoolImplTest : public TestBase { public: struct TestCodecClient { Http::MockClientConnection* codec_; diff --git a/test/common/http/http2/metadata_encoder_decoder_test.cc b/test/common/http/http2/metadata_encoder_decoder_test.cc index e65d27229c7ae..10e1023bbf5ba 100644 --- a/test/common/http/http2/metadata_encoder_decoder_test.cc +++ b/test/common/http/http2/metadata_encoder_decoder_test.cc @@ -4,8 +4,9 @@ #include "common/http/http2/metadata_encoder.h" #include "common/runtime/runtime_impl.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "nghttp2/nghttp2.h" // A global variable in nghttp2 to disable preface and initial settings for tests. @@ -80,7 +81,7 @@ static ssize_t send_callback(nghttp2_session* session, const uint8_t* buf, size_ } } // namespace -class MetadataEncoderDecoderTest : public ::testing::Test { +class MetadataEncoderDecoderTest : public TestBase { public: void initialize(MetadataCallback cb) { decoder_ = std::make_unique(cb); diff --git a/test/common/http/user_agent_test.cc b/test/common/http/user_agent_test.cc index d69b99c840513..d5a5a04a2f2e6 100644 --- a/test/common/http/user_agent_test.cc +++ b/test/common/http/user_agent_test.cc @@ -5,10 +5,9 @@ #include "test/mocks/stats/mocks.h" #include "test/test_common/printers.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::_; using testing::NiceMock; using testing::Property; diff --git a/test/common/http/utility_test.cc b/test/common/http/utility_test.cc index 06a737da93ef5..bd825d86acce3 100644 --- a/test/common/http/utility_test.cc +++ b/test/common/http/utility_test.cc @@ -10,10 +10,9 @@ #include "test/mocks/http/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::_; using testing::Invoke; using testing::InvokeWithoutArgs; diff --git a/test/common/json/config_schemas_test.cc b/test/common/json/config_schemas_test.cc index 703c1afa712dd..5a4d6eba6dc8d 100644 --- a/test/common/json/config_schemas_test.cc +++ b/test/common/json/config_schemas_test.cc @@ -7,10 +7,10 @@ #include "common/stats/isolated_store_impl.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; @@ -27,7 +27,7 @@ std::vector generateTestInputs() { return file_list; } -class ConfigSchemasTest : public ::testing::TestWithParam { +class ConfigSchemasTest : public TestBaseWithParam { protected: ConfigSchemasTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/json/json_loader_test.cc b/test/common/json/json_loader_test.cc index 82659a950c12e..2846fa4f0a556 100644 --- a/test/common/json/json_loader_test.cc +++ b/test/common/json/json_loader_test.cc @@ -4,14 +4,13 @@ #include "common/json/json_loader.h" #include "common/stats/isolated_store_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Json { -class JsonLoaderTest : public testing::Test { +class JsonLoaderTest : public TestBase { protected: JsonLoaderTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/memory/debug_test.cc b/test/common/memory/debug_test.cc index 6dfeca6cd67ed..694a4cfa89cc1 100644 --- a/test/common/memory/debug_test.cc +++ b/test/common/memory/debug_test.cc @@ -1,6 +1,6 @@ #include "common/memory/stats.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Memory { diff --git a/test/common/network/address_impl_test.cc b/test/common/network/address_impl_test.cc index c64538942915e..8cae44fe9589a 100644 --- a/test/common/network/address_impl_test.cc +++ b/test/common/network/address_impl_test.cc @@ -18,10 +18,9 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Network { namespace Address { @@ -107,7 +106,7 @@ void testSocketBindAndConnect(Network::Address::IpVersion ip_version, bool v6onl } } // namespace -class AddressImplSocketTest : public testing::TestWithParam {}; +class AddressImplSocketTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, AddressImplSocketTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); @@ -431,7 +430,7 @@ struct TestCase { uint32_t port_; // Ignored for Pipe }; -class MixedAddressTest : public testing::TestWithParam<::testing::tuple> { +class MixedAddressTest : public TestBaseWithParam<::testing::tuple> { public: protected: InstanceConstSharedPtr testCaseToInstance(const struct TestCase& test_case) { diff --git a/test/common/network/cidr_range_test.cc b/test/common/network/cidr_range_test.cc index 3636c530f97ac..e9df0bddb6649 100644 --- a/test/common/network/cidr_range_test.cc +++ b/test/common/network/cidr_range_test.cc @@ -11,7 +11,7 @@ #include "common/network/cidr_range.h" #include "common/network/utility.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" // We are adding things into the std namespace. // Note that this is technically undefined behavior! diff --git a/test/common/network/connection_impl_test.cc b/test/common/network/connection_impl_test.cc index 2f329456e17d1..9f8667b030829 100644 --- a/test/common/network/connection_impl_test.cc +++ b/test/common/network/connection_impl_test.cc @@ -22,10 +22,10 @@ #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -72,7 +72,7 @@ TEST(ConnectionImplUtility, updateBufferStats) { ConnectionImplUtility::updateBufferStats(3, 3, previous_total, counter, gauge); } -class ConnectionImplDeathTest : public testing::TestWithParam {}; +class ConnectionImplDeathTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, ConnectionImplDeathTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); @@ -90,7 +90,7 @@ TEST_P(ConnectionImplDeathTest, BadFd) { ".*assert failure: ioHandle\\(\\).fd\\(\\) != -1.*"); } -class ConnectionImplTest : public testing::TestWithParam { +class ConnectionImplTest : public TestBaseWithParam { public: ConnectionImplTest() : api_(Api::createApiForTest(stats_store_)) {} @@ -1229,7 +1229,7 @@ class FakeReadFilter : public Network::ReadFilter { private: ReadFilterCallbacks* callbacks_{nullptr}; }; -class MockTransportConnectionImplTest : public testing::Test { +class MockTransportConnectionImplTest : public TestBase { public: MockTransportConnectionImplTest() { EXPECT_CALL(dispatcher_.buffer_factory_, create_(_, _)) @@ -1643,7 +1643,7 @@ TEST_P(ReadBufferLimitTest, SomeLimit) { readBufferLimitTest(read_buffer_limit, read_buffer_limit - 1 + 16384); } -class TcpClientConnectionImplTest : public testing::TestWithParam { +class TcpClientConnectionImplTest : public TestBaseWithParam { protected: TcpClientConnectionImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(time_system_, *api_) {} @@ -1688,7 +1688,7 @@ TEST_P(TcpClientConnectionImplTest, BadConnectConnRefused) { dispatcher_.run(Event::Dispatcher::RunType::Block); } -class PipeClientConnectionImplTest : public testing::Test { +class PipeClientConnectionImplTest : public TestBase { protected: PipeClientConnectionImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(time_system_, *api_) {} diff --git a/test/common/network/dns_impl_test.cc b/test/common/network/dns_impl_test.cc index 3e74ab3511636..37cf0080bbc20 100644 --- a/test/common/network/dns_impl_test.cc +++ b/test/common/network/dns_impl_test.cc @@ -26,12 +26,12 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "ares.h" #include "ares_dns.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -323,7 +323,7 @@ class DnsResolverImplPeer { DnsResolverImpl* resolver_; }; -class DnsImplConstructor : public testing::Test { +class DnsImplConstructor : public TestBase { protected: DnsImplConstructor() : api_(Api::createApiForTest(stats_store_)), dispatcher_(test_time_.timeSystem(), *api_) {} @@ -405,7 +405,7 @@ TEST_F(DnsImplConstructor, BadCustomResolvers) { "DNS resolver 'foo' is not an IP address"); } -class DnsImplTest : public testing::TestWithParam { +class DnsImplTest : public TestBaseWithParam { public: DnsImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(test_time_.timeSystem(), *api_) {} diff --git a/test/common/network/filter_manager_impl_test.cc b/test/common/network/filter_manager_impl_test.cc index 5f5f1a63db88a..54d12d38debcd 100644 --- a/test/common/network/filter_manager_impl_test.cc +++ b/test/common/network/filter_manager_impl_test.cc @@ -20,9 +20,9 @@ #include "test/mocks/upstream/host.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -34,7 +34,7 @@ using testing::WithArgs; namespace Envoy { namespace Network { -class NetworkFilterManagerTest : public testing::Test, public BufferSource { +class NetworkFilterManagerTest : public TestBase, public BufferSource { public: StreamBuffer getReadBuffer() override { return {read_buffer_, read_end_stream_}; } StreamBuffer getWriteBuffer() override { return {write_buffer_, write_end_stream_}; } diff --git a/test/common/network/lc_trie_test.cc b/test/common/network/lc_trie_test.cc index 75b93e2dee1aa..d7383b952f7a8 100644 --- a/test/common/network/lc_trie_test.cc +++ b/test/common/network/lc_trie_test.cc @@ -5,15 +5,14 @@ #include "common/network/cidr_range.h" #include "common/network/lc_trie.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Network { namespace LcTrie { -class LcTrieTest : public testing::Test { +class LcTrieTest : public TestBase { public: void setup(const std::vector>& cidr_range_strings, bool exclusive = false, double fill_factor = 0, uint32_t root_branch_factor = 0) { diff --git a/test/common/network/listen_socket_impl_test.cc b/test/common/network/listen_socket_impl_test.cc index 8a4d787d8eb5c..285a829f76fcb 100644 --- a/test/common/network/listen_socket_impl_test.cc +++ b/test/common/network/listen_socket_impl_test.cc @@ -5,10 +5,9 @@ #include "test/mocks/network/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::_; using testing::Return; @@ -16,7 +15,7 @@ namespace Envoy { namespace Network { template -class ListenSocketImplTest : public testing::TestWithParam { +class ListenSocketImplTest : public TestBaseWithParam { protected: ListenSocketImplTest() : version_(GetParam()) {} const Address::IpVersion version_; diff --git a/test/common/network/listener_impl_test.cc b/test/common/network/listener_impl_test.cc index 2e04093199970..0e20d0f103635 100644 --- a/test/common/network/listener_impl_test.cc +++ b/test/common/network/listener_impl_test.cc @@ -6,11 +6,11 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -55,7 +55,7 @@ static void errorCallbackTest(Address::IpVersion version) { dispatcher.run(Event::Dispatcher::RunType::Block); } -class ListenerImplDeathTest : public testing::TestWithParam {}; +class ListenerImplDeathTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, ListenerImplDeathTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); @@ -73,7 +73,7 @@ class TestListenerImpl : public ListenerImpl { MOCK_METHOD1(getLocalAddress, Address::InstanceConstSharedPtr(int fd)); }; -class ListenerImplTest : public testing::TestWithParam { +class ListenerImplTest : public TestBaseWithParam { protected: ListenerImplTest() : version_(GetParam()), diff --git a/test/common/network/resolver_impl_test.cc b/test/common/network/resolver_impl_test.cc index 3a7496ea09b5c..e47534d03a0c6 100644 --- a/test/common/network/resolver_impl_test.cc +++ b/test/common/network/resolver_impl_test.cc @@ -14,14 +14,13 @@ #include "test/mocks/network/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Network { namespace Address { -class IpResolverTest : public testing::Test { +class IpResolverTest : public TestBase { public: Resolver* resolver_{Registry::FactoryRegistry::getFactory("envoy.ip")}; }; diff --git a/test/common/network/socket_option_factory_test.cc b/test/common/network/socket_option_factory_test.cc index 7ba8f53d1e518..4529316408e28 100644 --- a/test/common/network/socket_option_factory_test.cc +++ b/test/common/network/socket_option_factory_test.cc @@ -4,16 +4,15 @@ #include "test/mocks/api/mocks.h" #include "test/mocks/network/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" -#include "gtest/gtest.h" - using testing::_; namespace Envoy { namespace Network { -class SocketOptionFactoryTest : public testing::Test { +class SocketOptionFactoryTest : public TestBase { public: SocketOptionFactoryTest() = default; diff --git a/test/common/network/socket_option_test.h b/test/common/network/socket_option_test.h index fb218b015c3e1..0399ba981ca02 100644 --- a/test/common/network/socket_option_test.h +++ b/test/common/network/socket_option_test.h @@ -6,10 +6,9 @@ #include "test/mocks/api/mocks.h" #include "test/mocks/network/mocks.h" #include "test/test_common/logging.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" -#include "gtest/gtest.h" - using testing::_; using testing::Invoke; using testing::NiceMock; @@ -19,7 +18,7 @@ namespace Envoy { namespace Network { namespace { -class SocketOptionTest : public testing::Test { +class SocketOptionTest : public TestBase { public: SocketOptionTest() { socket_.local_address_.reset(); } diff --git a/test/common/network/udp_listener_impl_test.cc b/test/common/network/udp_listener_impl_test.cc index 3251d1b9775ed..0536a685c1133 100644 --- a/test/common/network/udp_listener_impl_test.cc +++ b/test/common/network/udp_listener_impl_test.cc @@ -10,11 +10,11 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -36,7 +36,7 @@ class TestUdpListenerImpl : public UdpListenerImpl { } }; -class ListenerImplTest : public testing::TestWithParam { +class ListenerImplTest : public TestBaseWithParam { protected: ListenerImplTest() : version_(GetParam()), diff --git a/test/common/network/utility_test.cc b/test/common/network/utility_test.cc index 675093150d30e..91007b4b62c7d 100644 --- a/test/common/network/utility_test.cc +++ b/test/common/network/utility_test.cc @@ -11,10 +11,9 @@ #include "test/mocks/network/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Network { @@ -154,7 +153,7 @@ TEST(NetworkUtility, ParseInternetAddressAndPort) { EXPECT_EQ("[::1]:0", Utility::parseInternetAddressAndPort("[::1]:0")->asString()); } -class NetworkUtilityGetLocalAddress : public testing::TestWithParam {}; +class NetworkUtilityGetLocalAddress : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, NetworkUtilityGetLocalAddress, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), diff --git a/test/common/protobuf/utility_test.cc b/test/common/protobuf/utility_test.cc index bdedbed7f78ff..58d4c00d2d12c 100644 --- a/test/common/protobuf/utility_test.cc +++ b/test/common/protobuf/utility_test.cc @@ -8,13 +8,12 @@ #include "common/stats/isolated_store_impl.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { -class ProtobufUtilityTest : public testing::Test { +class ProtobufUtilityTest : public TestBase { protected: ProtobufUtilityTest() : api_(Api::createApiForTest(stats_store_)) {} @@ -338,7 +337,7 @@ TEST(DurationUtilTest, OutOfRange) { } } -class TimestampUtilTest : public ::testing::Test, public ::testing::WithParamInterface {}; +class TimestampUtilTest : public TestBase, public ::testing::WithParamInterface {}; TEST_P(TimestampUtilTest, SystemClockToTimestampTest) { // Generate an input time_point, diff --git a/test/common/router/config_impl_test.cc b/test/common/router/config_impl_test.cc index 96499d1ee066d..40a2a9636a417 100644 --- a/test/common/router/config_impl_test.cc +++ b/test/common/router/config_impl_test.cc @@ -24,10 +24,10 @@ #include "test/test_common/environment.h" #include "test/test_common/printers.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ContainerEq; @@ -111,7 +111,7 @@ class ConfigImplTestBase { NiceMock factory_context_; }; -class RouteMatcherTest : public testing::Test, public ConfigImplTestBase {}; +class RouteMatcherTest : public TestBase, public ConfigImplTestBase {}; TEST_F(RouteMatcherTest, TestRoutes) { const std::string json = R"EOF( @@ -1382,7 +1382,7 @@ TEST_F(RouteMatcherTest, InvalidQueryParamMatchedRoutingConfig) { EnvoyException, "Invalid regex"); } -class RouterMatcherHashPolicyTest : public testing::Test, public ConfigImplTestBase { +class RouterMatcherHashPolicyTest : public TestBase, public ConfigImplTestBase { protected: RouterMatcherHashPolicyTest() : add_cookie_nop_( @@ -2220,7 +2220,7 @@ TEST_F(RouteMatcherTest, Shadow) { .runtimeKey()); } -class RouteConfigurationV2 : public testing::Test, public ConfigImplTestBase {}; +class RouteConfigurationV2 : public TestBase, public ConfigImplTestBase {}; TEST_F(RouteConfigurationV2, RequestMirrorPolicy) { const std::string yaml = R"EOF( @@ -3629,7 +3629,7 @@ TEST(NullConfigImplTest, All) { EXPECT_EQ("", config.name()); } -class BadHttpRouteConfigurationsTest : public testing::Test, public ConfigImplTestBase {}; +class BadHttpRouteConfigurationsTest : public TestBase, public ConfigImplTestBase {}; TEST_F(BadHttpRouteConfigurationsTest, BadRouteConfig) { const std::string json = R"EOF( @@ -3875,7 +3875,7 @@ TEST_F(RouteMatcherTest, TestOpaqueConfig) { EXPECT_EQ(opaque_config.find("name2")->second, "value2"); } -class RoutePropertyTest : public testing::Test, public ConfigImplTestBase {}; +class RoutePropertyTest : public TestBase, public ConfigImplTestBase {}; TEST_F(RoutePropertyTest, excludeVHRateLimits) { std::string json = R"EOF( @@ -4225,7 +4225,7 @@ TEST_F(RouteMatcherTest, Decorator) { } } -class CustomRequestHeadersTest : public testing::Test, public ConfigImplTestBase {}; +class CustomRequestHeadersTest : public TestBase, public ConfigImplTestBase {}; TEST_F(CustomRequestHeadersTest, AddNewHeader) { const std::string json = R"EOF( @@ -4406,7 +4406,7 @@ TEST(MetadataMatchCriteriaImpl, Merge) { EXPECT_EQ((*it)->value().value().string_value(), "override3"); } -class RouteEntryMetadataMatchTest : public testing::Test, public ConfigImplTestBase {}; +class RouteEntryMetadataMatchTest : public TestBase, public ConfigImplTestBase {}; TEST_F(RouteEntryMetadataMatchTest, ParsesMetadata) { auto route_config = envoy::api::v2::RouteConfiguration(); @@ -4518,7 +4518,7 @@ TEST_F(RouteEntryMetadataMatchTest, ParsesMetadata) { } } -class ConfigUtilityTest : public testing::Test, public ConfigImplTestBase {}; +class ConfigUtilityTest : public TestBase, public ConfigImplTestBase {}; TEST_F(ConfigUtilityTest, ParseResponseCode) { const std::vector< @@ -5247,7 +5247,7 @@ name: RetriableStatusCodes EXPECT_NE(predicates1, predicates2); } -class PerFilterConfigsTest : public testing::Test, public ConfigImplTestBase { +class PerFilterConfigsTest : public TestBase, public ConfigImplTestBase { public: PerFilterConfigsTest() : factory_(), registered_factory_(factory_), default_factory_(), diff --git a/test/common/router/header_formatter_test.cc b/test/common/router/header_formatter_test.cc index 327a9e8076640..58a8c9b37d350 100644 --- a/test/common/router/header_formatter_test.cc +++ b/test/common/router/header_formatter_test.cc @@ -15,10 +15,10 @@ #include "test/common/stream_info/test_int_accessor.h" #include "test/mocks/http/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::Return; @@ -33,7 +33,7 @@ static envoy::api::v2::route::Route parseRouteFromV2Yaml(const std::string& yaml return route; } -class StreamInfoHeaderFormatterTest : public testing::Test { +class StreamInfoHeaderFormatterTest : public TestBase { public: void testFormatting(const Envoy::StreamInfo::MockStreamInfo& stream_info, const std::string& variable, const std::string& expected_output) { diff --git a/test/common/router/rds_impl_test.cc b/test/common/router/rds_impl_test.cc index 7fa8cac0dc856..19171f44d5e01 100644 --- a/test/common/router/rds_impl_test.cc +++ b/test/common/router/rds_impl_test.cc @@ -21,10 +21,10 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -47,7 +47,7 @@ parseHttpConnectionManagerFromJson(const std::string& json_string, const Stats:: return http_connection_manager; } -class RdsTestBase : public testing::Test { +class RdsTestBase : public TestBase { public: RdsTestBase() : request_(&factory_context_.cluster_manager_.async_client_) {} diff --git a/test/common/router/retry_state_impl_test.cc b/test/common/router/retry_state_impl_test.cc index 61acbeaf199b4..f418c98922ca5 100644 --- a/test/common/router/retry_state_impl_test.cc +++ b/test/common/router/retry_state_impl_test.cc @@ -11,10 +11,10 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -23,7 +23,7 @@ using testing::Return; namespace Envoy { namespace Router { -class RouterRetryStateImplTest : public testing::Test { +class RouterRetryStateImplTest : public TestBase { public: RouterRetryStateImplTest() : callback_([this]() -> void { callback_ready_.ready(); }) { ON_CALL(runtime_.snapshot_, featureEnabled("upstream.use_retry", 100)) diff --git a/test/common/router/router_ratelimit_test.cc b/test/common/router/router_ratelimit_test.cc index ae5a104aec3ff..9ec8c79c1903f 100644 --- a/test/common/router/router_ratelimit_test.cc +++ b/test/common/router/router_ratelimit_test.cc @@ -14,10 +14,10 @@ #include "test/mocks/router/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -97,7 +97,7 @@ static Http::TestHeaderMapImpl genHeaders(const std::string& host, const std::st return Http::TestHeaderMapImpl{{":authority", host}, {":path", path}, {":method", method}}; } -class RateLimitConfiguration : public testing::Test { +class RateLimitConfiguration : public TestBase { public: void SetUpTest(const std::string json) { envoy::api::v2::RouteConfiguration route_config; @@ -343,7 +343,7 @@ TEST_F(RateLimitConfiguration, Stages) { EXPECT_TRUE(rate_limits.empty()); } -class RateLimitPolicyEntryTest : public testing::Test { +class RateLimitPolicyEntryTest : public TestBase { public: void SetUpTest(const std::string json) { rate_limit_entry_ = std::make_unique(parseRateLimitFromJson(json)); diff --git a/test/common/router/router_test.cc b/test/common/router/router_test.cc index c237bebacde07..ce54d1c0c3537 100644 --- a/test/common/router/router_test.cc +++ b/test/common/router/router_test.cc @@ -24,11 +24,11 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AssertionFailure; @@ -74,7 +74,7 @@ class TestFilter : public Filter { bool reject_all_hosts_ = false; }; -class RouterTestBase : public testing::Test { +class RouterTestBase : public TestBase { public: RouterTestBase(bool start_child_span, bool suppress_envoy_headers) : shadow_writer_(new MockShadowWriter()), diff --git a/test/common/router/router_upstream_log_test.cc b/test/common/router/router_upstream_log_test.cc index 64210156df153..8bf7069a6e14b 100644 --- a/test/common/router/router_upstream_log_test.cc +++ b/test/common/router/router_upstream_log_test.cc @@ -16,11 +16,11 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/server/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/types/optional.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -72,7 +72,7 @@ class TestFilter : public Filter { MockRetryState* retry_state_{}; }; -class RouterUpstreamLogTest : public testing::Test { +class RouterUpstreamLogTest : public TestBase { public: RouterUpstreamLogTest() {} diff --git a/test/common/router/shadow_writer_impl_test.cc b/test/common/router/shadow_writer_impl_test.cc index adf0cf593ea20..eb2859ca56446 100644 --- a/test/common/router/shadow_writer_impl_test.cc +++ b/test/common/router/shadow_writer_impl_test.cc @@ -6,9 +6,9 @@ #include "common/router/shadow_writer_impl.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -18,7 +18,7 @@ using testing::Return; namespace Envoy { namespace Router { -class ShadowWriterImplTest : public testing::Test { +class ShadowWriterImplTest : public TestBase { public: void expectShadowWriter(absl::string_view host, absl::string_view shadowed_host) { Http::MessagePtr message(new Http::RequestMessageImpl()); diff --git a/test/common/router/string_accessor_impl_test.cc b/test/common/router/string_accessor_impl_test.cc index 4138980f8b362..6cfe54ad8c420 100644 --- a/test/common/router/string_accessor_impl_test.cc +++ b/test/common/router/string_accessor_impl_test.cc @@ -1,7 +1,8 @@ #include "common/router/string_accessor_impl.h" +#include "test/test_common/test_base.h" + #include "absl/strings/string_view.h" -#include "gtest/gtest.h" namespace Envoy { namespace Router { diff --git a/test/common/runtime/runtime_impl_test.cc b/test/common/runtime/runtime_impl_test.cc index 74a5f7b0c8b71..aa99434d3bef4 100644 --- a/test/common/runtime/runtime_impl_test.cc +++ b/test/common/runtime/runtime_impl_test.cc @@ -9,9 +9,9 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -63,7 +63,7 @@ TEST(UUID, sanityCheckOfUniqueness) { EXPECT_EQ(num_of_uuids, uuids.size()); } -class DiskBackedLoaderImplTest : public testing::Test { +class DiskBackedLoaderImplTest : public TestBase { protected: DiskBackedLoaderImplTest() : api_(Api::createApiForTest(store)) {} @@ -260,7 +260,7 @@ TEST(LoaderImplTest, All) { testNewOverrides(loader, store); } -class DiskLayerTest : public testing::Test { +class DiskLayerTest : public TestBase { protected: DiskLayerTest() : api_(Api::createApiForTest(store_)) {} diff --git a/test/common/runtime/uuid_util_test.cc b/test/common/runtime/uuid_util_test.cc index 8596783038a53..fff1b87b6651f 100644 --- a/test/common/runtime/uuid_util_test.cc +++ b/test/common/runtime/uuid_util_test.cc @@ -3,7 +3,7 @@ #include "common/runtime/runtime_impl.h" #include "common/runtime/uuid_util.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { TEST(UUIDUtilsTest, mod) { diff --git a/test/common/secret/sds_api_test.cc b/test/common/secret/sds_api_test.cc index 7c11e3730f36e..39808f24d432d 100644 --- a/test/common/secret/sds_api_test.cc +++ b/test/common/secret/sds_api_test.cc @@ -13,10 +13,10 @@ #include "test/mocks/secret/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using ::testing::_; using ::testing::Invoke; @@ -26,7 +26,7 @@ namespace Envoy { namespace Secret { namespace { -class SdsApiTest : public testing::Test { +class SdsApiTest : public TestBase { protected: SdsApiTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/secret/secret_manager_impl_test.cc b/test/common/secret/secret_manager_impl_test.cc index 8b50f6678ecb7..7b3aa38238f66 100644 --- a/test/common/secret/secret_manager_impl_test.cc +++ b/test/common/secret/secret_manager_impl_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::Return; using testing::ReturnRef; @@ -22,7 +22,7 @@ namespace Envoy { namespace Secret { namespace { -class SecretManagerImplTest : public testing::Test { +class SecretManagerImplTest : public TestBase { protected: SecretManagerImplTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/singleton/threadsafe_singleton_test.cc b/test/common/singleton/threadsafe_singleton_test.cc index a9172aceade76..984e95c25ff0c 100644 --- a/test/common/singleton/threadsafe_singleton_test.cc +++ b/test/common/singleton/threadsafe_singleton_test.cc @@ -5,11 +5,10 @@ #include "common/singleton/threadsafe_singleton.h" #include "common/stats/isolated_store_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { class TestSingleton { diff --git a/test/common/stats/heap_stat_data_test.cc b/test/common/stats/heap_stat_data_test.cc index eac2c123ff2bb..6293df616a4e1 100644 --- a/test/common/stats/heap_stat_data_test.cc +++ b/test/common/stats/heap_stat_data_test.cc @@ -4,8 +4,7 @@ #include "common/stats/stats_options_impl.h" #include "test/test_common/logging.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Stats { diff --git a/test/common/stats/isolated_store_impl_test.cc b/test/common/stats/isolated_store_impl_test.cc index b2aaa80693fdd..ffb2069094221 100644 --- a/test/common/stats/isolated_store_impl_test.cc +++ b/test/common/stats/isolated_store_impl_test.cc @@ -4,9 +4,10 @@ #include "common/stats/isolated_store_impl.h" +#include "test/test_common/test_base.h" + #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include "gtest/gtest.h" namespace Envoy { namespace Stats { diff --git a/test/common/stats/raw_stat_data_test.cc b/test/common/stats/raw_stat_data_test.cc index 3b7b5575bfa73..d04421d105534 100644 --- a/test/common/stats/raw_stat_data_test.cc +++ b/test/common/stats/raw_stat_data_test.cc @@ -4,14 +4,13 @@ #include "common/stats/stats_options_impl.h" #include "test/test_common/logging.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Stats { -class RawStatDataTest : public testing::Test { +class RawStatDataTest : public TestBase { public: RawStatDataTest() : allocator_(stats_options_) {} diff --git a/test/common/stats/source_impl_test.cc b/test/common/stats/source_impl_test.cc index 8668626534c7a..a3a8bdec9bef8 100644 --- a/test/common/stats/source_impl_test.cc +++ b/test/common/stats/source_impl_test.cc @@ -3,8 +3,7 @@ #include "common/stats/source_impl.h" #include "test/mocks/stats/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::NiceMock; using testing::ReturnPointee; diff --git a/test/common/stats/stats_matcher_impl_test.cc b/test/common/stats/stats_matcher_impl_test.cc index 485560f2b702f..b70db7f78ec95 100644 --- a/test/common/stats/stats_matcher_impl_test.cc +++ b/test/common/stats/stats_matcher_impl_test.cc @@ -2,17 +2,16 @@ #include "common/stats/stats_matcher_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::IsFalse; using testing::IsTrue; namespace Envoy { namespace Stats { -class StatsMatcherTest : public testing::Test { +class StatsMatcherTest : public TestBase { protected: envoy::type::matcher::StringMatcher* inclusionList() { return stats_config_.mutable_stats_matcher()->mutable_inclusion_list()->add_patterns(); diff --git a/test/common/stats/symbol_table_impl_test.cc b/test/common/stats/symbol_table_impl_test.cc index 6b91a15236f41..571f2665d9471 100644 --- a/test/common/stats/symbol_table_impl_test.cc +++ b/test/common/stats/symbol_table_impl_test.cc @@ -7,10 +7,10 @@ #include "test/common/stats/stat_test_utility.h" #include "test/test_common/logging.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/synchronization/blocking_counter.h" -#include "gtest/gtest.h" namespace Envoy { namespace Stats { @@ -28,7 +28,7 @@ enum class SymbolTableType { Fake, }; -class StatNameTest : public testing::TestWithParam { +class StatNameTest : public TestBaseWithParam { protected: StatNameTest() { switch (GetParam()) { diff --git a/test/common/stats/tag_extractor_impl_test.cc b/test/common/stats/tag_extractor_impl_test.cc index 4fe93839194b6..d47b8610cee89 100644 --- a/test/common/stats/tag_extractor_impl_test.cc +++ b/test/common/stats/tag_extractor_impl_test.cc @@ -7,10 +7,9 @@ #include "common/stats/tag_extractor_impl.h" #include "common/stats/tag_producer_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Stats { diff --git a/test/common/stats/tag_producer_impl_test.cc b/test/common/stats/tag_producer_impl_test.cc index d97819ed4e9c6..965003f09d9dd 100644 --- a/test/common/stats/tag_producer_impl_test.cc +++ b/test/common/stats/tag_producer_impl_test.cc @@ -3,10 +3,9 @@ #include "common/config/well_known_names.h" #include "common/stats/tag_producer_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Stats { diff --git a/test/common/stats/thread_local_store_test.cc b/test/common/stats/thread_local_store_test.cc index 7d69bf0abae53..f13ed96ca61ce 100644 --- a/test/common/stats/thread_local_store_test.cc +++ b/test/common/stats/thread_local_store_test.cc @@ -17,11 +17,11 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/test_common/logging.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/str_split.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -33,7 +33,7 @@ using testing::Return; namespace Envoy { namespace Stats { -class StatsThreadLocalStoreTest : public testing::Test { +class StatsThreadLocalStoreTest : public TestBase { public: void SetUp() override { alloc_ = std::make_unique(options_); @@ -71,7 +71,7 @@ class HistogramWrapper { histogram_t* histogram_; }; -class HistogramTest : public testing::Test { +class HistogramTest : public TestBase { public: typedef std::map NameHistogramMap; diff --git a/test/common/stream_info/filter_state_impl_test.cc b/test/common/stream_info/filter_state_impl_test.cc index 56fbbd91d00d1..779077a4b94bf 100644 --- a/test/common/stream_info/filter_state_impl_test.cc +++ b/test/common/stream_info/filter_state_impl_test.cc @@ -2,10 +2,9 @@ #include "common/stream_info/filter_state_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace StreamInfo { namespace { @@ -44,7 +43,7 @@ class SimpleType : public FilterState::Object { int value_; }; -class FilterStateImplTest : public testing::Test { +class FilterStateImplTest : public TestBase { public: FilterStateImplTest() { resetFilterState(); } diff --git a/test/common/stream_info/stream_info_impl_test.cc b/test/common/stream_info/stream_info_impl_test.cc index 62a62166040b9..d094e623ba0d6 100644 --- a/test/common/stream_info/stream_info_impl_test.cc +++ b/test/common/stream_info/stream_info_impl_test.cc @@ -12,9 +12,9 @@ #include "test/common/stream_info/test_int_accessor.h" #include "test/mocks/router/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace StreamInfo { @@ -27,7 +27,7 @@ std::chrono::nanoseconds checkDuration(std::chrono::nanoseconds last, return timing.value(); } -class StreamInfoImplTest : public testing::Test { +class StreamInfoImplTest : public TestBase { protected: DangerousDeprecatedTestTime test_time_; }; diff --git a/test/common/stream_info/utility_test.cc b/test/common/stream_info/utility_test.cc index 51781b85df801..e96ddd17eab3f 100644 --- a/test/common/stream_info/utility_test.cc +++ b/test/common/stream_info/utility_test.cc @@ -2,9 +2,9 @@ #include "common/stream_info/utility.h" #include "test/mocks/stream_info/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/common/tcp/conn_pool_test.cc b/test/common/tcp/conn_pool_test.cc index b3f26916eabad..84f4cd72db6b3 100644 --- a/test/common/tcp/conn_pool_test.cc +++ b/test/common/tcp/conn_pool_test.cc @@ -12,10 +12,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -152,7 +152,7 @@ class ConnPoolImplForTest : public ConnPoolImpl { /** * Test fixture for connection pool tests. */ -class TcpConnPoolImplTest : public testing::Test { +class TcpConnPoolImplTest : public TestBase { public: TcpConnPoolImplTest() : upstream_ready_timer_(new NiceMock(&dispatcher_)), @@ -175,7 +175,7 @@ class TcpConnPoolImplTest : public testing::Test { /** * Test fixture for connection pool destructor tests. */ -class TcpConnPoolImplDestructorTest : public testing::Test { +class TcpConnPoolImplDestructorTest : public TestBase { public: TcpConnPoolImplDestructorTest() : upstream_ready_timer_(new NiceMock(&dispatcher_)), diff --git a/test/common/tcp_proxy/tcp_proxy_test.cc b/test/common/tcp_proxy/tcp_proxy_test.cc index cb04f0bb5c126..9f1dced174f20 100644 --- a/test/common/tcp_proxy/tcp_proxy_test.cc +++ b/test/common/tcp_proxy/tcp_proxy_test.cc @@ -25,9 +25,9 @@ #include "test/mocks/upstream/host.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -346,7 +346,7 @@ TEST(ConfigTest, AccessLogConfig) { EXPECT_EQ(2, config_obj.accessLogs().size()); } -class TcpProxyTest : public testing::Test { +class TcpProxyTest : public TestBase { public: TcpProxyTest() { ON_CALL(*factory_context_.access_log_manager_.file_, write(_)) @@ -1076,7 +1076,7 @@ TEST_F(TcpProxyTest, UpstreamFlushReceiveUpstreamData) { upstream_callbacks_->onUpstreamData(buffer, false); } -class TcpProxyRoutingTest : public testing::Test { +class TcpProxyRoutingTest : public TestBase { public: TcpProxyRoutingTest() { std::string json = R"EOF( diff --git a/test/common/thread/thread_factory_singleton_test.cc b/test/common/thread/thread_factory_singleton_test.cc index d50fc69ee417c..dd474ce520f8a 100644 --- a/test/common/thread/thread_factory_singleton_test.cc +++ b/test/common/thread/thread_factory_singleton_test.cc @@ -2,14 +2,15 @@ #include "common/common/assert.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Thread { namespace { -class ThreadFactorySingletonTest : public testing::Test { +class ThreadFactorySingletonTest : public TestBase { protected: ThreadFactorySingletonTest() : run_tid_(Envoy::Thread::ThreadFactorySingleton::get().currentThreadId()) {} diff --git a/test/common/thread_local/thread_local_impl_test.cc b/test/common/thread_local/thread_local_impl_test.cc index 0f67f18c50220..49e228030d1a4 100644 --- a/test/common/thread_local/thread_local_impl_test.cc +++ b/test/common/thread_local/thread_local_impl_test.cc @@ -23,7 +23,7 @@ class TestThreadLocalObject : public ThreadLocalObject { MOCK_METHOD0(onDestroy, void()); }; -class ThreadLocalInstanceImplTest : public testing::Test { +class ThreadLocalInstanceImplTest : public TestBase { public: ThreadLocalInstanceImplTest() { tls_.registerThread(main_dispatcher_, true); diff --git a/test/common/tracing/http_tracer_impl_test.cc b/test/common/tracing/http_tracer_impl_test.cc index 99e07658df811..ea92647f524e2 100644 --- a/test/common/tracing/http_tracer_impl_test.cc +++ b/test/common/tracing/http_tracer_impl_test.cc @@ -18,10 +18,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -323,7 +323,7 @@ TEST(HttpNullTracerTest, BasicFunctionality) { EXPECT_NE(nullptr, span_ptr->spawnChild(config, "foo", SystemTime())); } -class HttpTracerImplTest : public testing::Test { +class HttpTracerImplTest : public TestBase { public: HttpTracerImplTest() { driver_ = new MockDriver(); diff --git a/test/common/upstream/cds_api_impl_test.cc b/test/common/upstream/cds_api_impl_test.cc index 3c58882352941..205611fb88c52 100644 --- a/test/common/upstream/cds_api_impl_test.cc +++ b/test/common/upstream/cds_api_impl_test.cc @@ -12,10 +12,10 @@ #include "test/mocks/local_info/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -26,7 +26,7 @@ using testing::ReturnRef; namespace Envoy { namespace Upstream { -class CdsApiImplTest : public testing::Test { +class CdsApiImplTest : public TestBase { protected: CdsApiImplTest() : request_(&cm_.async_client_), api_(Api::createApiForTest(store_)) {} diff --git a/test/common/upstream/cluster_manager_impl_test.cc b/test/common/upstream/cluster_manager_impl_test.cc index f03f9b7901c91..ade2b7b5e399e 100644 --- a/test/common/upstream/cluster_manager_impl_test.cc +++ b/test/common/upstream/cluster_manager_impl_test.cc @@ -30,11 +30,11 @@ #include "test/mocks/thread_local/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -163,7 +163,7 @@ envoy::config::bootstrap::v2::Bootstrap parseBootstrapFromV2Yaml(const std::stri return bootstrap; } -class ClusterManagerImplTest : public testing::Test { +class ClusterManagerImplTest : public TestBase { public: ClusterManagerImplTest() : api_(Api::createApiForTest(stats_store_)) {} @@ -2336,7 +2336,7 @@ TEST_F(ClusterManagerImplTest, MergedUpdatesDestroyedOnUpdate) { EXPECT_EQ(0, factory_.stats_.gauge("cluster_manager.warming_clusters").value()); } -class ClusterManagerInitHelperTest : public testing::Test { +class ClusterManagerInitHelperTest : public TestBase { public: MOCK_METHOD1(onClusterInit, void(Cluster& cluster)); diff --git a/test/common/upstream/edf_scheduler_test.cc b/test/common/upstream/edf_scheduler_test.cc index ddb39bf847a05..9962b6f5cd6d2 100644 --- a/test/common/upstream/edf_scheduler_test.cc +++ b/test/common/upstream/edf_scheduler_test.cc @@ -1,6 +1,6 @@ #include "common/upstream/edf_scheduler.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Upstream { diff --git a/test/common/upstream/eds_test.cc b/test/common/upstream/eds_test.cc index 8a729e80378a4..be98cdf9f97eb 100644 --- a/test/common/upstream/eds_test.cc +++ b/test/common/upstream/eds_test.cc @@ -15,10 +15,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/ssl/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; @@ -27,7 +27,7 @@ using testing::ReturnRef; namespace Envoy { namespace Upstream { -class EdsTest : public testing::Test { +class EdsTest : public TestBase { protected: EdsTest() : api_(Api::createApiForTest(stats_)) { resetCluster(); } diff --git a/test/common/upstream/hds_test.cc b/test/common/upstream/hds_test.cc index 2f2963891d6ba..501aa9aa76929 100644 --- a/test/common/upstream/hds_test.cc +++ b/test/common/upstream/hds_test.cc @@ -15,10 +15,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtLeast; @@ -42,7 +42,7 @@ class HdsDelegateFriend { }; }; -class HdsTest : public testing::Test { +class HdsTest : public TestBase { protected: HdsTest() : retry_timer_(new Event::MockTimer()), server_response_timer_(new Event::MockTimer()), diff --git a/test/common/upstream/health_checker_impl_test.cc b/test/common/upstream/health_checker_impl_test.cc index e930588f9d4a3..bf7e3b2c65751 100644 --- a/test/common/upstream/health_checker_impl_test.cc +++ b/test/common/upstream/health_checker_impl_test.cc @@ -24,10 +24,10 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -101,7 +101,7 @@ class TestHttpHealthCheckerImpl : public HttpHealthCheckerImpl { Http::CodecClient::Type codecClientType() { return codec_client_type_; } }; -class HttpHealthCheckerImplTest : public testing::Test { +class HttpHealthCheckerImplTest : public TestBase { public: struct TestSession { TestSession() {} @@ -1969,7 +1969,7 @@ TEST(TcpHealthCheckMatcher, match) { EXPECT_TRUE(TcpHealthCheckMatcher::match(segments, buffer)); } -class TcpHealthCheckerImplTest : public testing::Test { +class TcpHealthCheckerImplTest : public TestBase { public: TcpHealthCheckerImplTest() : cluster_(new NiceMock()), event_logger_(new MockHealthCheckEventLogger()) {} @@ -2753,7 +2753,7 @@ class GrpcHealthCheckerImplTestBase { std::list codec_index_{}; }; -class GrpcHealthCheckerImplTest : public GrpcHealthCheckerImplTestBase, public testing::Test {}; +class GrpcHealthCheckerImplTest : public GrpcHealthCheckerImplTestBase, public TestBase {}; // Test single host check success. TEST_F(GrpcHealthCheckerImplTest, Success) { testSingleHostSuccess(absl::nullopt); } @@ -3382,7 +3382,7 @@ TEST_F(GrpcHealthCheckerImplTest, GoAwayBetweenChecks) { class BadResponseGrpcHealthCheckerImplTest : public GrpcHealthCheckerImplTestBase, - public testing::TestWithParam {}; + public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P( BadResponse, BadResponseGrpcHealthCheckerImplTest, diff --git a/test/common/upstream/host_utility_test.cc b/test/common/upstream/host_utility_test.cc index f6c37823d051a..ce26ba708725e 100644 --- a/test/common/upstream/host_utility_test.cc +++ b/test/common/upstream/host_utility_test.cc @@ -4,8 +4,7 @@ #include "test/common/upstream/utility.h" #include "test/mocks/upstream/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Upstream { diff --git a/test/common/upstream/load_balancer_impl_test.cc b/test/common/upstream/load_balancer_impl_test.cc index 3d624e6c43965..5d59c4806a1aa 100644 --- a/test/common/upstream/load_balancer_impl_test.cc +++ b/test/common/upstream/load_balancer_impl_test.cc @@ -11,9 +11,9 @@ #include "test/common/upstream/utility.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::ElementsAre; using testing::NiceMock; @@ -23,7 +23,7 @@ using testing::ReturnRef; namespace Envoy { namespace Upstream { -class LoadBalancerTestBase : public ::testing::TestWithParam { +class LoadBalancerTestBase : public TestBaseWithParam { protected: // Run all tests against both priority 0 and priority 1 host sets, to ensure // all the load balancers have equivalent functonality for failover host sets. diff --git a/test/common/upstream/load_balancer_simulation_test.cc b/test/common/upstream/load_balancer_simulation_test.cc index 7474b90727514..14267d825b685 100644 --- a/test/common/upstream/load_balancer_simulation_test.cc +++ b/test/common/upstream/load_balancer_simulation_test.cc @@ -11,9 +11,9 @@ #include "test/common/upstream/utility.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::Return; @@ -90,7 +90,7 @@ TEST(DISABLED_LeastRequestLoadBalancerWeightTest, Weight) { /** * This test is for simulation only and should not be run as part of unit tests. */ -class DISABLED_SimulationTest : public testing::Test { +class DISABLED_SimulationTest : public TestBase { public: DISABLED_SimulationTest() : stats_(ClusterInfoImpl::generateStats(stats_store_)) { ON_CALL(runtime_.snapshot_, getInteger("upstream.healthy_panic_threshold", 50U)) diff --git a/test/common/upstream/load_stats_reporter_test.cc b/test/common/upstream/load_stats_reporter_test.cc index beed927a71704..f860248996989 100644 --- a/test/common/upstream/load_stats_reporter_test.cc +++ b/test/common/upstream/load_stats_reporter_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/local_info/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -26,7 +26,7 @@ using testing::Return; namespace Envoy { namespace Upstream { -class LoadStatsReporterTest : public testing::Test { +class LoadStatsReporterTest : public TestBase { public: LoadStatsReporterTest() : retry_timer_(new Event::MockTimer()), response_timer_(new Event::MockTimer()), diff --git a/test/common/upstream/logical_dns_cluster_test.cc b/test/common/upstream/logical_dns_cluster_test.cc index 0c27abdc0fdfe..9d55f81d1e5ed 100644 --- a/test/common/upstream/logical_dns_cluster_test.cc +++ b/test/common/upstream/logical_dns_cluster_test.cc @@ -21,10 +21,10 @@ #include "test/mocks/ssl/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -35,7 +35,7 @@ namespace Upstream { enum class ConfigType { V2_YAML, V1_JSON }; -class LogicalDnsClusterTest : public testing::Test { +class LogicalDnsClusterTest : public TestBase { protected: LogicalDnsClusterTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/common/upstream/maglev_lb_test.cc b/test/common/upstream/maglev_lb_test.cc index b0208e9836195..34f196251da7f 100644 --- a/test/common/upstream/maglev_lb_test.cc +++ b/test/common/upstream/maglev_lb_test.cc @@ -20,7 +20,7 @@ class TestLoadBalancerContext : public LoadBalancerContextBase { // Note: ThreadAwareLoadBalancer base is heavily tested by RingHashLoadBalancerTest. Only basic // functionality is covered here. -class MaglevLoadBalancerTest : public ::testing::Test { +class MaglevLoadBalancerTest : public TestBase { public: MaglevLoadBalancerTest() : stats_(ClusterInfoImpl::generateStats(stats_store_)) {} diff --git a/test/common/upstream/original_dst_cluster_test.cc b/test/common/upstream/original_dst_cluster_test.cc index dc6e51e3f8771..f052e5d56a21b 100644 --- a/test/common/upstream/original_dst_cluster_test.cc +++ b/test/common/upstream/original_dst_cluster_test.cc @@ -22,10 +22,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/ssl/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -57,7 +57,7 @@ class TestLoadBalancerContext : public LoadBalancerContextBase { Http::HeaderMapPtr downstream_headers_; }; -class OriginalDstClusterTest : public testing::Test { +class OriginalDstClusterTest : public TestBase { public: // cleanup timer must be created before the cluster (in setup()), so that we can set expectations // on it. Ownership is transferred to the cluster at the cluster constructor, so the cluster will diff --git a/test/common/upstream/outlier_detection_impl_test.cc b/test/common/upstream/outlier_detection_impl_test.cc index 5a85a50ac3464..c55da17c86190 100644 --- a/test/common/upstream/outlier_detection_impl_test.cc +++ b/test/common/upstream/outlier_detection_impl_test.cc @@ -16,10 +16,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "absl/types/optional.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -56,7 +56,7 @@ class CallbackChecker { MOCK_METHOD1(check, void(HostSharedPtr host)); }; -class OutlierDetectorImplTest : public testing::Test { +class OutlierDetectorImplTest : public TestBase { public: OutlierDetectorImplTest() { ON_CALL(runtime_.snapshot_, featureEnabled("outlier_detection.enforcing_consecutive_5xx", 100)) diff --git a/test/common/upstream/resource_manager_impl_test.cc b/test/common/upstream/resource_manager_impl_test.cc index 73610ab81c5fb..c726700ad77a0 100644 --- a/test/common/upstream/resource_manager_impl_test.cc +++ b/test/common/upstream/resource_manager_impl_test.cc @@ -5,9 +5,9 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/common/upstream/ring_hash_lb_test.cc b/test/common/upstream/ring_hash_lb_test.cc index 0ef94dd3dd00b..8f6e5234380a7 100644 --- a/test/common/upstream/ring_hash_lb_test.cc +++ b/test/common/upstream/ring_hash_lb_test.cc @@ -12,9 +12,9 @@ #include "test/common/upstream/utility.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -33,7 +33,7 @@ class TestLoadBalancerContext : public LoadBalancerContextBase { absl::optional hash_key_; }; -class RingHashLoadBalancerTest : public ::testing::TestWithParam { +class RingHashLoadBalancerTest : public TestBaseWithParam { public: RingHashLoadBalancerTest() : stats_(ClusterInfoImpl::generateStats(stats_store_)) {} diff --git a/test/common/upstream/subset_lb_test.cc b/test/common/upstream/subset_lb_test.cc index 49b29a98be673..a7447a226d54a 100644 --- a/test/common/upstream/subset_lb_test.cc +++ b/test/common/upstream/subset_lb_test.cc @@ -17,10 +17,10 @@ #include "test/mocks/filesystem/mocks.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "absl/types/optional.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::EndsWith; @@ -106,7 +106,7 @@ class TestLoadBalancerContext : public LoadBalancerContextBase { enum UpdateOrder { REMOVES_FIRST, SIMULTANEOUS }; -class SubsetLoadBalancerTest : public testing::TestWithParam { +class SubsetLoadBalancerTest : public TestBaseWithParam { public: SubsetLoadBalancerTest() : stats_(ClusterInfoImpl::generateStats(stats_store_)) { stats_.max_host_weight_.set(1UL); diff --git a/test/common/upstream/upstream_impl_test.cc b/test/common/upstream/upstream_impl_test.cc index efa170dc6e2a3..a84e7b834b985 100644 --- a/test/common/upstream/upstream_impl_test.cc +++ b/test/common/upstream/upstream_impl_test.cc @@ -28,10 +28,10 @@ #include "test/mocks/ssl/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ContainerEq; @@ -134,7 +134,7 @@ std::vector generateStrictDnsParams() { return dns_config; } -class StrictDnsParamTest : public testing::TestWithParam, +class StrictDnsParamTest : public TestBaseWithParam, public UpstreamImplTestBase {}; INSTANTIATE_TEST_SUITE_P(DnsParam, StrictDnsParamTest, @@ -176,7 +176,7 @@ TEST_P(StrictDnsParamTest, ImmediateResolve) { EXPECT_EQ(2UL, cluster.prioritySet().hostSetsPerPriority()[0]->healthyHosts().size()); } -class StrictDnsClusterImplTest : public testing::Test, public UpstreamImplTestBase { +class StrictDnsClusterImplTest : public TestBase, public UpstreamImplTestBase { protected: std::shared_ptr dns_resolver_ = std::make_shared(); @@ -846,7 +846,7 @@ TEST(HostImplTest, HealthFlags) { EXPECT_EQ(Host::Health::Degraded, host->health()); } -class StaticClusterImplTest : public testing::Test, public UpstreamImplTestBase {}; +class StaticClusterImplTest : public TestBase, public UpstreamImplTestBase {}; TEST_F(StaticClusterImplTest, InitialHosts) { const std::string yaml = R"EOF( @@ -1446,7 +1446,7 @@ TEST_F(StaticClusterImplTest, SourceAddressPriority) { } } -class ClusterImplTest : public testing::Test, public UpstreamImplTestBase {}; +class ClusterImplTest : public TestBase, public UpstreamImplTestBase {}; // Test that the correct feature() is set when close_connections_on_host_health_failure is // configured. @@ -1532,7 +1532,7 @@ TEST(PrioritySet, Extend) { } } -class ClusterInfoImplTest : public testing::Test { +class ClusterInfoImplTest : public TestBase { public: ClusterInfoImplTest() : api_(Api::createApiForTest(stats_)) {} @@ -1976,7 +1976,7 @@ TEST(HostsPerLocalityImpl, Filter) { } } -class HostSetImplLocalityTest : public ::testing::Test { +class HostSetImplLocalityTest : public TestBase { public: LocalityWeightsConstSharedPtr locality_weights_; HostSetImpl host_set_{0, kDefaultOverProvisioningFactor}; diff --git a/test/config/utility.cc b/test/config/utility.cc index 467fa9d8b7fbd..4f1e353372d7a 100644 --- a/test/config/utility.cc +++ b/test/config/utility.cc @@ -12,10 +12,10 @@ #include "test/config/integration/certs/clientcert_hash.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/str_replace.h" -#include "gtest/gtest.h" namespace Envoy { diff --git a/test/config_test/config_test.cc b/test/config_test/config_test.cc index f2a83ab1196b8..f7efcaab48630 100644 --- a/test/config_test/config_test.cc +++ b/test/config_test/config_test.cc @@ -14,11 +14,11 @@ #include "test/integration/server.h" #include "test/mocks/server/mocks.h" #include "test/mocks/ssl/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/config_test/example_configs_test.cc b/test/config_test/example_configs_test.cc index ca85b6f1ecad2..6f4c7fe4428b8 100644 --- a/test/config_test/example_configs_test.cc +++ b/test/config_test/example_configs_test.cc @@ -1,9 +1,8 @@ #include "test/config_test/config_test.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { TEST(ExampleConfigsTest, All) { TestEnvironment::exec( diff --git a/test/coverage/gcc_only_test/gcc_only_test.cc b/test/coverage/gcc_only_test/gcc_only_test.cc index 31346323d20e4..ced70a1e7213f 100644 --- a/test/coverage/gcc_only_test/gcc_only_test.cc +++ b/test/coverage/gcc_only_test/gcc_only_test.cc @@ -1,4 +1,4 @@ -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/exe/main_common_test.cc b/test/exe/main_common_test.cc index 54f8ef9d10e25..0040171dbe53d 100644 --- a/test/exe/main_common_test.cc +++ b/test/exe/main_common_test.cc @@ -11,10 +11,9 @@ #include "test/test_common/contention.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - #ifdef ENVOY_HANDLE_SIGNALS #include "exe/signal_action.h" #endif @@ -32,7 +31,7 @@ namespace Envoy { * an argv array that is terminated with nullptr. Identifies the config * file relative to $TEST_RUNDIR. */ -class MainCommonTest : public testing::TestWithParam { +class MainCommonTest : public TestBaseWithParam { protected: MainCommonTest() : config_file_(TestEnvironment::temporaryFileSubstitute( diff --git a/test/exe/signals_test.cc b/test/exe/signals_test.cc index eb07fe61370a5..99ff8fa73cb9d 100644 --- a/test/exe/signals_test.cc +++ b/test/exe/signals_test.cc @@ -3,10 +3,9 @@ #include "exe/signal_action.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { #if defined(__has_feature) #if __has_feature(address_sanitizer) diff --git a/test/exe/terminate_handler_test.cc b/test/exe/terminate_handler_test.cc index f37774352b3a3..bb84c26ffd41c 100644 --- a/test/exe/terminate_handler_test.cc +++ b/test/exe/terminate_handler_test.cc @@ -1,9 +1,8 @@ #include "exe/terminate_handler.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { TEST(TerminateHandlerDeathTest, HandlerInstalledTest) { diff --git a/test/extensions/access_loggers/file/config_test.cc b/test/extensions/access_loggers/file/config_test.cc index 14e35b40c72fe..b309c55d3c1ad 100644 --- a/test/extensions/access_loggers/file/config_test.cc +++ b/test/extensions/access_loggers/file/config_test.cc @@ -9,9 +9,9 @@ #include "extensions/access_loggers/well_known_names.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/access_loggers/http_grpc/config_test.cc b/test/extensions/access_loggers/http_grpc/config_test.cc index b337fe4cf9d43..5bf1e1134ed0f 100644 --- a/test/extensions/access_loggers/http_grpc/config_test.cc +++ b/test/extensions/access_loggers/http_grpc/config_test.cc @@ -6,9 +6,9 @@ #include "extensions/access_loggers/well_known_names.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -19,7 +19,7 @@ namespace Extensions { namespace AccessLoggers { namespace HttpGrpc { -class HttpGrpcAccessLogConfigTest : public testing::Test { +class HttpGrpcAccessLogConfigTest : public TestBase { public: void SetUp() override { factory_ = diff --git a/test/extensions/access_loggers/http_grpc/grpc_access_log_impl_test.cc b/test/extensions/access_loggers/http_grpc/grpc_access_log_impl_test.cc index 1b5aed984b6e0..ebc8fe6482600 100644 --- a/test/extensions/access_loggers/http_grpc/grpc_access_log_impl_test.cc +++ b/test/extensions/access_loggers/http_grpc/grpc_access_log_impl_test.cc @@ -22,7 +22,7 @@ namespace Extensions { namespace AccessLoggers { namespace HttpGrpc { -class GrpcAccessLogStreamerImplTest : public testing::Test { +class GrpcAccessLogStreamerImplTest : public TestBase { public: typedef Grpc::MockAsyncStream MockAccessLogStream; typedef Grpc::TypedAsyncStreamCallbacks @@ -112,7 +112,7 @@ class MockGrpcAccessLogStreamer : public GrpcAccessLogStreamer { const std::string& log_name)); }; -class HttpGrpcAccessLogTest : public testing::Test { +class HttpGrpcAccessLogTest : public TestBase { public: void init() { ON_CALL(*filter_, evaluate(_, _)).WillByDefault(Return(true)); diff --git a/test/extensions/access_loggers/http_grpc/grpc_access_log_integration_test.cc b/test/extensions/access_loggers/http_grpc/grpc_access_log_integration_test.cc index 59b5b1b3f92ec..16015e13764cd 100644 --- a/test/extensions/access_loggers/http_grpc/grpc_access_log_integration_test.cc +++ b/test/extensions/access_loggers/http_grpc/grpc_access_log_integration_test.cc @@ -8,10 +8,9 @@ #include "test/common/grpc/grpc_client_integration.h" #include "test/integration/http_integration.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::AssertionResult; namespace Envoy { diff --git a/test/extensions/common/tap/admin_test.cc b/test/extensions/common/tap/admin_test.cc index 8af5250432135..665e137cfcac9 100644 --- a/test/extensions/common/tap/admin_test.cc +++ b/test/extensions/common/tap/admin_test.cc @@ -1,8 +1,7 @@ #include "extensions/common/tap/admin.h" #include "test/mocks/server/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::_; using testing::Return; @@ -22,7 +21,7 @@ class MockExtensionConfig : public ExtensionConfig { void(envoy::service::tap::v2alpha::TapConfig&& proto_config, Sink* admin_streamer)); }; -class AdminHandlerTest : public testing::Test { +class AdminHandlerTest : public TestBase { public: AdminHandlerTest() { EXPECT_CALL(admin_, addHandler("/tap", "tap filter control", _, true, true)) diff --git a/test/extensions/common/tap/tap_matcher_test.cc b/test/extensions/common/tap/tap_matcher_test.cc index e7265f221952f..214e3166b87f7 100644 --- a/test/extensions/common/tap/tap_matcher_test.cc +++ b/test/extensions/common/tap/tap_matcher_test.cc @@ -2,17 +2,16 @@ #include "extensions/common/tap/tap_matcher.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace Common { namespace Tap { namespace { -class TapMatcherTest : public testing::Test { +class TapMatcherTest : public TestBase { public: std::vector matchers_; std::vector statuses_; diff --git a/test/extensions/filters/common/ext_authz/check_request_utils_test.cc b/test/extensions/filters/common/ext_authz/check_request_utils_test.cc index f03291fb2f499..01aef6d695655 100644 --- a/test/extensions/filters/common/ext_authz/check_request_utils_test.cc +++ b/test/extensions/filters/common/ext_authz/check_request_utils_test.cc @@ -7,9 +7,9 @@ #include "test/mocks/ssl/mocks.h" #include "test/mocks/stream_info/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::Return; using testing::ReturnPointee; @@ -21,7 +21,7 @@ namespace Filters { namespace Common { namespace ExtAuthz { -class CheckRequestUtilsTest : public testing::Test { +class CheckRequestUtilsTest : public TestBase { public: CheckRequestUtilsTest() { addr_ = std::make_shared("1.2.3.4", 1111); diff --git a/test/extensions/filters/common/ext_authz/ext_authz_grpc_impl_test.cc b/test/extensions/filters/common/ext_authz/ext_authz_grpc_impl_test.cc index 7c74aca575c22..ef56a5bdacd87 100644 --- a/test/extensions/filters/common/ext_authz/ext_authz_grpc_impl_test.cc +++ b/test/extensions/filters/common/ext_authz/ext_authz_grpc_impl_test.cc @@ -9,9 +9,9 @@ #include "test/extensions/filters/common/ext_authz/test_common.h" #include "test/mocks/grpc/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -28,7 +28,7 @@ namespace Filters { namespace Common { namespace ExtAuthz { -class ExtAuthzGrpcClientTest : public testing::Test { +class ExtAuthzGrpcClientTest : public TestBase { public: ExtAuthzGrpcClientTest() : async_client_(new Grpc::MockAsyncClient()), timeout_(10), diff --git a/test/extensions/filters/common/ext_authz/ext_authz_http_impl_test.cc b/test/extensions/filters/common/ext_authz/ext_authz_http_impl_test.cc index 57a332ec78ccd..4a529ccce0a06 100644 --- a/test/extensions/filters/common/ext_authz/ext_authz_http_impl_test.cc +++ b/test/extensions/filters/common/ext_authz/ext_authz_http_impl_test.cc @@ -10,9 +10,9 @@ #include "test/extensions/filters/common/ext_authz/mocks.h" #include "test/extensions/filters/common/ext_authz/test_common.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AllOf; @@ -30,7 +30,7 @@ namespace Filters { namespace Common { namespace ExtAuthz { -class ExtAuthzHttpClientTest : public testing::Test { +class ExtAuthzHttpClientTest : public TestBase { public: ExtAuthzHttpClientTest() : cm_{}, async_client_{}, diff --git a/test/extensions/filters/common/lua/lua_test.cc b/test/extensions/filters/common/lua/lua_test.cc index 720c1794b78a2..4d81601c290d0 100644 --- a/test/extensions/filters/common/lua/lua_test.cc +++ b/test/extensions/filters/common/lua/lua_test.cc @@ -33,7 +33,7 @@ class TestObject : public BaseLuaObject { int TestObject::luaTestCall(lua_State* state) { return doTestCall(state); } -class LuaTest : public testing::Test { +class LuaTest : public TestBase { public: LuaTest() : yield_callback_([this]() { on_yield_.ready(); }) {} diff --git a/test/extensions/filters/common/lua/lua_wrappers.h b/test/extensions/filters/common/lua/lua_wrappers.h index e1e7a41f1d0fe..a48bc2880d2e7 100644 --- a/test/extensions/filters/common/lua/lua_wrappers.h +++ b/test/extensions/filters/common/lua/lua_wrappers.h @@ -14,7 +14,7 @@ namespace Filters { namespace Common { namespace Lua { -template class LuaWrappersTestBase : public testing::Test { +template class LuaWrappersTestBase : public TestBase { public: virtual void setup(const std::string& code) { coroutine_.reset(); diff --git a/test/extensions/filters/common/ratelimit/ratelimit_impl_test.cc b/test/extensions/filters/common/ratelimit/ratelimit_impl_test.cc index a2db5f48367c0..6b21bd4f69bcf 100644 --- a/test/extensions/filters/common/ratelimit/ratelimit_impl_test.cc +++ b/test/extensions/filters/common/ratelimit/ratelimit_impl_test.cc @@ -14,10 +14,10 @@ #include "test/mocks/grpc/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtLeast; @@ -41,7 +41,7 @@ class MockRequestCallbacks : public RequestCallbacks { MOCK_METHOD2(complete_, void(LimitStatus status, const Http::HeaderMap* headers)); }; -class RateLimitGrpcClientTest : public testing::Test { +class RateLimitGrpcClientTest : public TestBase { public: RateLimitGrpcClientTest() : async_client_(new Grpc::MockAsyncClient()), diff --git a/test/extensions/filters/common/rbac/engine_impl_test.cc b/test/extensions/filters/common/rbac/engine_impl_test.cc index 5f86e76785132..cab08a096eebb 100644 --- a/test/extensions/filters/common/rbac/engine_impl_test.cc +++ b/test/extensions/filters/common/rbac/engine_impl_test.cc @@ -4,9 +4,9 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/ssl/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Const; diff --git a/test/extensions/filters/common/rbac/matchers_test.cc b/test/extensions/filters/common/rbac/matchers_test.cc index d38b17a86803f..95438862b4826 100644 --- a/test/extensions/filters/common/rbac/matchers_test.cc +++ b/test/extensions/filters/common/rbac/matchers_test.cc @@ -4,9 +4,9 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/ssl/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Const; diff --git a/test/extensions/filters/http/buffer/buffer_filter_test.cc b/test/extensions/filters/http/buffer/buffer_filter_test.cc index 34c1bd05298b6..4a6ff63dcb64b 100644 --- a/test/extensions/filters/http/buffer/buffer_filter_test.cc +++ b/test/extensions/filters/http/buffer/buffer_filter_test.cc @@ -12,9 +12,9 @@ #include "test/mocks/buffer/mocks.h" #include "test/mocks/http/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -28,7 +28,7 @@ namespace Extensions { namespace HttpFilters { namespace BufferFilter { -class BufferFilterTest : public testing::Test { +class BufferFilterTest : public TestBase { public: BufferFilterConfigSharedPtr setupConfig() { envoy::config::filter::http::buffer::v2::Buffer proto_config; diff --git a/test/extensions/filters/http/buffer/config_test.cc b/test/extensions/filters/http/buffer/config_test.cc index 98e87a8d66fd9..63b3ea3dff537 100644 --- a/test/extensions/filters/http/buffer/config_test.cc +++ b/test/extensions/filters/http/buffer/config_test.cc @@ -4,9 +4,9 @@ #include "extensions/filters/http/buffer/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/filters/http/common/aws/signer_impl_test.cc b/test/extensions/filters/http/common/aws/signer_impl_test.cc index 7d8d7331bc3d5..e877d764c19b4 100644 --- a/test/extensions/filters/http/common/aws/signer_impl_test.cc +++ b/test/extensions/filters/http/common/aws/signer_impl_test.cc @@ -17,7 +17,7 @@ namespace HttpFilters { namespace Common { namespace Aws { -class SignerImplTest : public testing::Test { +class SignerImplTest : public TestBase { public: SignerImplTest() : credentials_provider_(new NiceMock()), diff --git a/test/extensions/filters/http/common/aws/utility_test.cc b/test/extensions/filters/http/common/aws/utility_test.cc index 802e06036d3f5..eaf0b483b7933 100644 --- a/test/extensions/filters/http/common/aws/utility_test.cc +++ b/test/extensions/filters/http/common/aws/utility_test.cc @@ -1,9 +1,8 @@ #include "extensions/filters/http/common/aws/utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::ElementsAre; using testing::Pair; diff --git a/test/extensions/filters/http/common/jwks_fetcher_test.cc b/test/extensions/filters/http/common/jwks_fetcher_test.cc index 46ce0063b1c0e..a1bc4a2d74edf 100644 --- a/test/extensions/filters/http/common/jwks_fetcher_test.cc +++ b/test/extensions/filters/http/common/jwks_fetcher_test.cc @@ -49,7 +49,7 @@ cluster: pubkey_cluster seconds: 5 )"; -class JwksFetcherTest : public ::testing::Test { +class JwksFetcherTest : public TestBase { public: void SetUp() { MessageUtil::loadFromYaml(JwksUri, uri_); } HttpUri uri_; 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 d1008ece992fb..b5880df48a807 100644 --- a/test/extensions/filters/http/cors/cors_filter_integration_test.cc +++ b/test/extensions/filters/http/cors/cors_filter_integration_test.cc @@ -1,13 +1,12 @@ #include "test/integration/http_integration.h" #include "test/mocks/http/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { class CorsFilterIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: CorsFilterIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/extensions/filters/http/cors/cors_filter_test.cc b/test/extensions/filters/http/cors/cors_filter_test.cc index 1558eb3462abd..e2dc13fb0a53b 100644 --- a/test/extensions/filters/http/cors/cors_filter_test.cc +++ b/test/extensions/filters/http/cors/cors_filter_test.cc @@ -6,9 +6,9 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -24,7 +24,7 @@ namespace Extensions { namespace HttpFilters { namespace Cors { -class CorsFilterTest : public testing::Test { +class CorsFilterTest : public TestBase { public: CorsFilterTest() : config_(new CorsFilterConfig("test.", stats_)), filter_(config_) { cors_policy_ = std::make_unique(); diff --git a/test/extensions/filters/http/dynamo/config_test.cc b/test/extensions/filters/http/dynamo/config_test.cc index f4fba1ccf90db..1e13225ddeafc 100644 --- a/test/extensions/filters/http/dynamo/config_test.cc +++ b/test/extensions/filters/http/dynamo/config_test.cc @@ -1,9 +1,9 @@ #include "extensions/filters/http/dynamo/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/http/dynamo/dynamo_filter_test.cc b/test/extensions/filters/http/dynamo/dynamo_filter_test.cc index 204eba44f9c75..e78590c2e44ba 100644 --- a/test/extensions/filters/http/dynamo/dynamo_filter_test.cc +++ b/test/extensions/filters/http/dynamo/dynamo_filter_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -26,7 +26,7 @@ namespace Extensions { namespace HttpFilters { namespace Dynamo { -class DynamoFilterTest : public testing::Test { +class DynamoFilterTest : public TestBase { public: void setup(bool enabled) { ON_CALL(loader_.snapshot_, featureEnabled("dynamodb.filter_enabled", 100)) diff --git a/test/extensions/filters/http/dynamo/dynamo_request_parser_test.cc b/test/extensions/filters/http/dynamo/dynamo_request_parser_test.cc index 330baed379f43..f9a61b116af53 100644 --- a/test/extensions/filters/http/dynamo/dynamo_request_parser_test.cc +++ b/test/extensions/filters/http/dynamo/dynamo_request_parser_test.cc @@ -7,10 +7,9 @@ #include "extensions/filters/http/dynamo/dynamo_request_parser.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace HttpFilters { diff --git a/test/extensions/filters/http/dynamo/dynamo_utility_test.cc b/test/extensions/filters/http/dynamo/dynamo_utility_test.cc index 83014009e7d8c..1834bee14db92 100644 --- a/test/extensions/filters/http/dynamo/dynamo_utility_test.cc +++ b/test/extensions/filters/http/dynamo/dynamo_utility_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/http/dynamo/dynamo_utility.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/filters/http/ext_authz/config_test.cc b/test/extensions/filters/http/ext_authz/config_test.cc index d6043f785588e..a16d7ad9acb29 100644 --- a/test/extensions/filters/http/ext_authz/config_test.cc +++ b/test/extensions/filters/http/ext_authz/config_test.cc @@ -4,9 +4,9 @@ #include "extensions/filters/http/ext_authz/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/http/ext_authz/ext_authz_test.cc b/test/extensions/filters/http/ext_authz/ext_authz_test.cc index 97c55dc9676c6..b064f78ade3d1 100644 --- a/test/extensions/filters/http/ext_authz/ext_authz_test.cc +++ b/test/extensions/filters/http/ext_authz/ext_authz_test.cc @@ -25,10 +25,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -36,7 +36,6 @@ using testing::Invoke; using testing::NiceMock; using testing::Return; using testing::ReturnRef; -using testing::TestWithParam; using testing::Values; using testing::WithArgs; @@ -82,12 +81,11 @@ template class HttpFilterTestBase : public T { } }; -class HttpFilterTest : public HttpFilterTestBase {}; +class HttpFilterTest : public HttpFilterTestBase {}; typedef envoy::config::filter::http::ext_authz::v2::ExtAuthz CreateFilterConfigFunc(); -class HttpFilterTestParam - : public HttpFilterTestBase> { +class HttpFilterTestParam : public HttpFilterTestBase> { public: virtual void SetUp() override { initialize(""); } }; diff --git a/test/extensions/filters/http/fault/config_test.cc b/test/extensions/filters/http/fault/config_test.cc index cac94593579a4..82bce8efd16ee 100644 --- a/test/extensions/filters/http/fault/config_test.cc +++ b/test/extensions/filters/http/fault/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/http/fault/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/http/fault/fault_filter_test.cc b/test/extensions/filters/http/fault/fault_filter_test.cc index 36963bdc285d4..18d464e20e20e 100644 --- a/test/extensions/filters/http/fault/fault_filter_test.cc +++ b/test/extensions/filters/http/fault/fault_filter_test.cc @@ -18,10 +18,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/runtime/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -36,7 +36,7 @@ namespace Extensions { namespace HttpFilters { namespace Fault { -class FaultFilterTest : public testing::Test { +class FaultFilterTest : public TestBase { public: const std::string fixed_delay_and_abort_nodes_json = R"EOF( { diff --git a/test/extensions/filters/http/grpc_http1_bridge/config_test.cc b/test/extensions/filters/http/grpc_http1_bridge/config_test.cc index 62eac3c9ed090..101aa36ff2873 100644 --- a/test/extensions/filters/http/grpc_http1_bridge/config_test.cc +++ b/test/extensions/filters/http/grpc_http1_bridge/config_test.cc @@ -1,9 +1,9 @@ #include "extensions/filters/http/grpc_http1_bridge/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/http/grpc_http1_bridge/http1_bridge_filter_test.cc b/test/extensions/filters/http/grpc_http1_bridge/http1_bridge_filter_test.cc index 49bb87f4e868e..ac3bc03983821 100644 --- a/test/extensions/filters/http/grpc_http1_bridge/http1_bridge_filter_test.cc +++ b/test/extensions/filters/http/grpc_http1_bridge/http1_bridge_filter_test.cc @@ -6,10 +6,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -22,7 +22,7 @@ namespace Extensions { namespace HttpFilters { namespace GrpcHttp1Bridge { -class GrpcHttp1BridgeFilterTest : public testing::Test { +class GrpcHttp1BridgeFilterTest : public TestBase { public: GrpcHttp1BridgeFilterTest() : filter_() { filter_.setDecoderFilterCallbacks(decoder_callbacks_); 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 e46b5c84e75fc..eb07083c764ec 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 @@ -6,10 +6,10 @@ #include "test/integration/http_integration.h" #include "test/mocks/http/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" -#include "gtest/gtest.h" using Envoy::Http::HeaderValueOf; @@ -18,7 +18,7 @@ namespace Envoy { // Tests a downstream HTTP2 client sending gRPC requests that are converted into HTTP/1.1 for a // HTTP1 upstream. class ReverseBridgeIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: ReverseBridgeIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam(), realTime()) {} diff --git a/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_test.cc b/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_test.cc index c9fc1527d05e6..8e36ee5ad7573 100644 --- a/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_test.cc +++ b/test/extensions/filters/http/grpc_http1_reverse_bridge/reverse_bridge_test.cc @@ -12,10 +12,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using Envoy::Http::HeaderValueOf; using testing::_; @@ -27,7 +27,7 @@ namespace Extensions { namespace HttpFilters { namespace GrpcHttp1ReverseBridge { -class ReverseBridgeTest : public testing::Test { +class ReverseBridgeTest : public TestBase { protected: void initialize(bool withhold_grpc_headers = true) { filter_ = std::make_unique("application/x-protobuf", withhold_grpc_headers); diff --git a/test/extensions/filters/http/grpc_json_transcoder/config_test.cc b/test/extensions/filters/http/grpc_json_transcoder/config_test.cc index 1a431615d6696..31f12b47d1cd1 100644 --- a/test/extensions/filters/http/grpc_json_transcoder/config_test.cc +++ b/test/extensions/filters/http/grpc_json_transcoder/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/http/grpc_json_transcoder/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { 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 b2477934ba2a0..64c63b6cbfdc8 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 @@ -6,10 +6,10 @@ #include "test/integration/http_integration.h" #include "test/mocks/http/mocks.h" #include "test/proto/bookstore.pb.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" -#include "gtest/gtest.h" using Envoy::Protobuf::Message; using Envoy::Protobuf::TextFormat; @@ -20,9 +20,8 @@ using Envoy::ProtobufWkt::Empty; namespace Envoy { -class GrpcJsonTranscoderIntegrationTest - : public HttpIntegrationTest, - public testing::TestWithParam { +class GrpcJsonTranscoderIntegrationTest : public HttpIntegrationTest, + public TestBaseWithParam { public: GrpcJsonTranscoderIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/extensions/filters/http/grpc_json_transcoder/json_transcoder_filter_test.cc b/test/extensions/filters/http/grpc_json_transcoder/json_transcoder_filter_test.cc index 3fc56f08a66dd..f5ad48329deab 100644 --- a/test/extensions/filters/http/grpc_json_transcoder/json_transcoder_filter_test.cc +++ b/test/extensions/filters/http/grpc_json_transcoder/json_transcoder_filter_test.cc @@ -15,10 +15,10 @@ #include "test/proto/bookstore.pb.h" #include "test/test_common/environment.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -50,7 +50,7 @@ class GrpcJsonTranscoderFilterTestBase { Api::ApiPtr api_; }; -class GrpcJsonTranscoderConfigTest : public testing::Test, public GrpcJsonTranscoderFilterTestBase { +class GrpcJsonTranscoderConfigTest : public TestBase, public GrpcJsonTranscoderFilterTestBase { protected: const envoy::config::filter::http::transcoder::v2::GrpcJsonTranscoder getProtoConfig(const std::string& descriptor_path, const std::string& service_name, @@ -271,7 +271,7 @@ TEST_F(GrpcJsonTranscoderConfigTest, InvalidVariableBinding) { EXPECT_FALSE(transcoder); } -class GrpcJsonTranscoderFilterTest : public testing::Test, public GrpcJsonTranscoderFilterTestBase { +class GrpcJsonTranscoderFilterTest : public TestBase, public GrpcJsonTranscoderFilterTestBase { protected: GrpcJsonTranscoderFilterTest(const bool match_incoming_request_route = false) : config_(bookstoreProtoConfig(match_incoming_request_route), *api_), filter_(config_) { @@ -702,7 +702,7 @@ struct GrpcJsonTranscoderFilterPrintTestParam { }; class GrpcJsonTranscoderFilterPrintTest - : public testing::TestWithParam, + : public TestBaseWithParam, public GrpcJsonTranscoderFilterTestBase { protected: GrpcJsonTranscoderFilterPrintTest() { diff --git a/test/extensions/filters/http/grpc_json_transcoder/transcoder_input_stream_test.cc b/test/extensions/filters/http/grpc_json_transcoder/transcoder_input_stream_test.cc index e72c8beaa24ff..9d2d8aab8d80c 100644 --- a/test/extensions/filters/http/grpc_json_transcoder/transcoder_input_stream_test.cc +++ b/test/extensions/filters/http/grpc_json_transcoder/transcoder_input_stream_test.cc @@ -2,7 +2,7 @@ #include "extensions/filters/http/grpc_json_transcoder/transcoder_input_stream_impl.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { @@ -10,7 +10,7 @@ namespace HttpFilters { namespace GrpcJsonTranscoder { namespace { -class TranscoderInputStreamTest : public testing::Test { +class TranscoderInputStreamTest : public TestBase { public: TranscoderInputStreamTest() { Buffer::OwnedImpl buffer{"abcd"}; diff --git a/test/extensions/filters/http/grpc_web/config_test.cc b/test/extensions/filters/http/grpc_web/config_test.cc index 6035cd312dc54..8c1aa3729a560 100644 --- a/test/extensions/filters/http/grpc_web/config_test.cc +++ b/test/extensions/filters/http/grpc_web/config_test.cc @@ -1,9 +1,9 @@ #include "extensions/filters/http/grpc_web/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/http/grpc_web/grpc_web_filter_test.cc b/test/extensions/filters/http/grpc_web/grpc_web_filter_test.cc index c9bad9b824a68..b9fcb90c96d50 100644 --- a/test/extensions/filters/http/grpc_web/grpc_web_filter_test.cc +++ b/test/extensions/filters/http/grpc_web/grpc_web_filter_test.cc @@ -12,10 +12,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Combine; @@ -45,7 +45,7 @@ const size_t TRAILERS_SIZE = sizeof(TRAILERS) - 1; } // namespace -class GrpcWebFilterTest : public testing::TestWithParam> { +class GrpcWebFilterTest : public TestBaseWithParam> { public: GrpcWebFilterTest() : filter_() { filter_.setDecoderFilterCallbacks(decoder_callbacks_); 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 00e24d9bab558..aa56d03ee1e96 100644 --- a/test/extensions/filters/http/gzip/gzip_filter_integration_test.cc +++ b/test/extensions/filters/http/gzip/gzip_filter_integration_test.cc @@ -4,14 +4,13 @@ #include "test/integration/http_integration.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { class GzipIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: GzipIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), simTime()) {} diff --git a/test/extensions/filters/http/gzip/gzip_filter_test.cc b/test/extensions/filters/http/gzip/gzip_filter_test.cc index bfe1389dd7aaa..6161e095e5468 100644 --- a/test/extensions/filters/http/gzip/gzip_filter_test.cc +++ b/test/extensions/filters/http/gzip/gzip_filter_test.cc @@ -9,10 +9,9 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::Return; namespace Envoy { @@ -20,7 +19,7 @@ namespace Extensions { namespace HttpFilters { namespace Gzip { -class GzipFilterTest : public testing::Test { +class GzipFilterTest : public TestBase { protected: GzipFilterTest() { ON_CALL(runtime_.snapshot_, featureEnabled("gzip.filter_enabled", 100)) diff --git a/test/extensions/filters/http/header_to_metadata/header_to_metadata_filter_test.cc b/test/extensions/filters/http/header_to_metadata/header_to_metadata_filter_test.cc index f756d9c5f37b9..42f3973b4f54f 100644 --- a/test/extensions/filters/http/header_to_metadata/header_to_metadata_filter_test.cc +++ b/test/extensions/filters/http/header_to_metadata/header_to_metadata_filter_test.cc @@ -4,10 +4,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/stream_info/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -17,7 +17,7 @@ namespace Extensions { namespace HttpFilters { namespace HeaderToMetadataFilter { -class HeaderToMetadataTest : public testing::Test { +class HeaderToMetadataTest : public TestBase { public: HeaderToMetadataTest() {} diff --git a/test/extensions/filters/http/health_check/config_test.cc b/test/extensions/filters/http/health_check/config_test.cc index b2b7b33935608..fd7cb7bad3cd2 100644 --- a/test/extensions/filters/http/health_check/config_test.cc +++ b/test/extensions/filters/http/health_check/config_test.cc @@ -1,10 +1,10 @@ #include "extensions/filters/http/health_check/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/http/health_check/health_check_test.cc b/test/extensions/filters/http/health_check/health_check_test.cc index 8c13393197158..6aa280d235c6d 100644 --- a/test/extensions/filters/http/health_check/health_check_test.cc +++ b/test/extensions/filters/http/health_check/health_check_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/upstream/cluster_info.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -28,7 +28,7 @@ namespace Extensions { namespace HttpFilters { namespace HealthCheck { -class HealthCheckFilterTest : public testing::Test { +class HealthCheckFilterTest : public TestBase { public: HealthCheckFilterTest(bool pass_through, bool caching) : request_headers_{{":path", "/healthcheck"}}, request_headers_no_hc_{{":path", "/foo"}} { diff --git a/test/extensions/filters/http/ip_tagging/ip_tagging_filter_test.cc b/test/extensions/filters/http/ip_tagging/ip_tagging_filter_test.cc index b48b9a9f3ead5..69a47eb221e00 100644 --- a/test/extensions/filters/http/ip_tagging/ip_tagging_filter_test.cc +++ b/test/extensions/filters/http/ip_tagging/ip_tagging_filter_test.cc @@ -11,10 +11,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/runtime/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; @@ -25,7 +25,7 @@ namespace Extensions { namespace HttpFilters { namespace IpTagging { -class IpTaggingFilterTest : public testing::Test { +class IpTaggingFilterTest : public TestBase { public: IpTaggingFilterTest() { ON_CALL(runtime_.snapshot_, featureEnabled("ip_tagging.http_filter_enabled", 100)) diff --git a/test/extensions/filters/http/jwt_authn/all_verifier_test.cc b/test/extensions/filters/http/jwt_authn/all_verifier_test.cc index 59db8de2d8707..06f7f8ac9903f 100644 --- a/test/extensions/filters/http/jwt_authn/all_verifier_test.cc +++ b/test/extensions/filters/http/jwt_authn/all_verifier_test.cc @@ -17,7 +17,7 @@ namespace Extensions { namespace HttpFilters { namespace JwtAuthn { -class AllVerifierTest : public ::testing::Test { +class AllVerifierTest : public TestBase { public: void SetUp() { MessageUtil::loadFromYaml(ExampleConfig, proto_config_); } diff --git a/test/extensions/filters/http/jwt_authn/authenticator_test.cc b/test/extensions/filters/http/jwt_authn/authenticator_test.cc index e0d52927e2bc2..143120ff0c312 100644 --- a/test/extensions/filters/http/jwt_authn/authenticator_test.cc +++ b/test/extensions/filters/http/jwt_authn/authenticator_test.cc @@ -9,10 +9,9 @@ #include "test/extensions/filters/http/jwt_authn/mock.h" #include "test/extensions/filters/http/jwt_authn/test_common.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using ::envoy::config::filter::http::jwt_authn::v2alpha::JwtAuthentication; using Envoy::Extensions::HttpFilters::Common::JwksFetcher; using Envoy::Extensions::HttpFilters::Common::JwksFetcherPtr; @@ -28,7 +27,7 @@ namespace Extensions { namespace HttpFilters { namespace JwtAuthn { -class AuthenticatorTest : public ::testing::Test { +class AuthenticatorTest : public TestBase { public: void SetUp() { MessageUtil::loadFromYaml(ExampleConfig, proto_config_); diff --git a/test/extensions/filters/http/jwt_authn/extractor_test.cc b/test/extensions/filters/http/jwt_authn/extractor_test.cc index 49f9dfe3ea434..11aa484583fc7 100644 --- a/test/extensions/filters/http/jwt_authn/extractor_test.cc +++ b/test/extensions/filters/http/jwt_authn/extractor_test.cc @@ -48,7 +48,7 @@ const char ExampleConfig[] = R"( value_prefix: AAABBB )"; -class ExtractorTest : public ::testing::Test { +class ExtractorTest : public TestBase { public: void SetUp() { MessageUtil::loadFromYaml(ExampleConfig, config_); diff --git a/test/extensions/filters/http/jwt_authn/filter_factory_test.cc b/test/extensions/filters/http/jwt_authn/filter_factory_test.cc index dfb2c94ff5842..6f1b60f227683 100644 --- a/test/extensions/filters/http/jwt_authn/filter_factory_test.cc +++ b/test/extensions/filters/http/jwt_authn/filter_factory_test.cc @@ -4,9 +4,9 @@ #include "test/extensions/filters/http/jwt_authn/test_common.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using ::envoy::config::filter::http::jwt_authn::v2alpha::JwtAuthentication; using ::envoy::config::filter::http::jwt_authn::v2alpha::JwtProvider; diff --git a/test/extensions/filters/http/jwt_authn/filter_test.cc b/test/extensions/filters/http/jwt_authn/filter_test.cc index 71f7589698333..7c988a5ee91ac 100644 --- a/test/extensions/filters/http/jwt_authn/filter_test.cc +++ b/test/extensions/filters/http/jwt_authn/filter_test.cc @@ -3,10 +3,10 @@ #include "test/extensions/filters/http/jwt_authn/mock.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using ::envoy::config::filter::http::jwt_authn::v2alpha::JwtAuthentication; using ::google::jwt_verify::Status; @@ -33,7 +33,7 @@ class MockFilterConfig : public FilterConfig { MOCK_CONST_METHOD1(findVerifier, const Verifier*(const Http::HeaderMap& headers)); }; -class FilterTest : public ::testing::Test { +class FilterTest : public TestBase { public: void SetUp() { mock_config_ = ::std::make_shared(proto_config_, "", mock_context_); diff --git a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc index 1f7b2ad14c4f5..66855054ef8ff 100644 --- a/test/extensions/filters/http/jwt_authn/group_verifier_test.cc +++ b/test/extensions/filters/http/jwt_authn/group_verifier_test.cc @@ -64,7 +64,7 @@ typedef std::unordered_map StatusMap; constexpr auto allowfailed = "_allow_failed_"; -class GroupVerifierTest : public ::testing::Test { +class GroupVerifierTest : public TestBase { public: void createVerifier() { ON_CALL(mock_factory_, create(_, _, _)) diff --git a/test/extensions/filters/http/jwt_authn/jwks_cache_test.cc b/test/extensions/filters/http/jwt_authn/jwks_cache_test.cc index 37871daea0862..b8daf0214ea6d 100644 --- a/test/extensions/filters/http/jwt_authn/jwks_cache_test.cc +++ b/test/extensions/filters/http/jwt_authn/jwks_cache_test.cc @@ -19,7 +19,7 @@ namespace HttpFilters { namespace JwtAuthn { namespace { -class JwksCacheTest : public ::testing::Test { +class JwksCacheTest : public TestBase { protected: JwksCacheTest() : api_(Api::createApiForTest(stats_)) {} void SetUp() { diff --git a/test/extensions/filters/http/jwt_authn/matcher_test.cc b/test/extensions/filters/http/jwt_authn/matcher_test.cc index 8adc79dbbc400..f0f916c78fd1d 100644 --- a/test/extensions/filters/http/jwt_authn/matcher_test.cc +++ b/test/extensions/filters/http/jwt_authn/matcher_test.cc @@ -23,7 +23,7 @@ namespace HttpFilters { namespace JwtAuthn { namespace { -class MatcherTest : public ::testing::Test { +class MatcherTest : public TestBase { public: }; diff --git a/test/extensions/filters/http/jwt_authn/provider_verifier_test.cc b/test/extensions/filters/http/jwt_authn/provider_verifier_test.cc index b0da46ef6b66b..33954a27453c4 100644 --- a/test/extensions/filters/http/jwt_authn/provider_verifier_test.cc +++ b/test/extensions/filters/http/jwt_authn/provider_verifier_test.cc @@ -27,7 +27,7 @@ ProtobufWkt::Struct getExpectedPayload(const std::string& name) { return struct_obj; } -class ProviderVerifierTest : public ::testing::Test { +class ProviderVerifierTest : public TestBase { public: void createVerifier() { filter_config_ = ::std::make_shared(proto_config_, "", mock_factory_ctx_); diff --git a/test/extensions/filters/http/lua/config_test.cc b/test/extensions/filters/http/lua/config_test.cc index f9c113fc1449e..e1de99b6f32c2 100644 --- a/test/extensions/filters/http/lua/config_test.cc +++ b/test/extensions/filters/http/lua/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/http/lua/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/http/lua/lua_filter_test.cc b/test/extensions/filters/http/lua/lua_filter_test.cc index 7e9d9486d3fda..4955cb1b4ffcf 100644 --- a/test/extensions/filters/http/lua/lua_filter_test.cc +++ b/test/extensions/filters/http/lua/lua_filter_test.cc @@ -37,7 +37,7 @@ class TestFilter : public Filter { MOCK_METHOD2(scriptLog, void(spdlog::level::level_enum level, const char* message)); }; -class LuaHttpFilterTest : public testing::Test { +class LuaHttpFilterTest : public TestBase { public: LuaHttpFilterTest() { // Avoid strict mock failures for the following calls. We want strict for other calls. diff --git a/test/extensions/filters/http/lua/lua_integration_test.cc b/test/extensions/filters/http/lua/lua_integration_test.cc index cc7d04ac871df..9af429f4aef6c 100644 --- a/test/extensions/filters/http/lua/lua_integration_test.cc +++ b/test/extensions/filters/http/lua/lua_integration_test.cc @@ -1,15 +1,14 @@ #include "extensions/filters/http/well_known_names.h" #include "test/integration/http_integration.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace { class LuaIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: LuaIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/extensions/filters/http/ratelimit/config_test.cc b/test/extensions/filters/http/ratelimit/config_test.cc index 8ce784acf917e..7b6ae66567a40 100644 --- a/test/extensions/filters/http/ratelimit/config_test.cc +++ b/test/extensions/filters/http/ratelimit/config_test.cc @@ -6,9 +6,9 @@ #include "extensions/filters/http/ratelimit/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ReturnRef; diff --git a/test/extensions/filters/http/ratelimit/ratelimit_test.cc b/test/extensions/filters/http/ratelimit/ratelimit_test.cc index 5ee6c2881c49c..ca5583c2569b4 100644 --- a/test/extensions/filters/http/ratelimit/ratelimit_test.cc +++ b/test/extensions/filters/http/ratelimit/ratelimit_test.cc @@ -18,10 +18,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -37,7 +37,7 @@ namespace Extensions { namespace HttpFilters { namespace RateLimitFilter { -class HttpRateLimitFilterTest : public testing::Test { +class HttpRateLimitFilterTest : public TestBase { public: HttpRateLimitFilterTest() { ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.http_filter_enabled", 100)) diff --git a/test/extensions/filters/http/rbac/config_test.cc b/test/extensions/filters/http/rbac/config_test.cc index 6085958c10717..646b527f0fed7 100644 --- a/test/extensions/filters/http/rbac/config_test.cc +++ b/test/extensions/filters/http/rbac/config_test.cc @@ -2,9 +2,9 @@ #include "extensions/filters/http/rbac/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/filters/http/rbac/rbac_filter_test.cc b/test/extensions/filters/http/rbac/rbac_filter_test.cc index bdeb72975287d..0ff7ddc7bedea 100644 --- a/test/extensions/filters/http/rbac/rbac_filter_test.cc +++ b/test/extensions/filters/http/rbac/rbac_filter_test.cc @@ -21,7 +21,7 @@ namespace HttpFilters { namespace RBACFilter { namespace { -class RoleBasedAccessControlFilterTest : public testing::Test { +class RoleBasedAccessControlFilterTest : public TestBase { public: RoleBasedAccessControlFilterConfigSharedPtr setupConfig() { envoy::config::filter::http::rbac::v2::RBAC config; diff --git a/test/extensions/filters/http/router/config_test.cc b/test/extensions/filters/http/router/config_test.cc index 89732808e5784..5c444d16e0cef 100644 --- a/test/extensions/filters/http/router/config_test.cc +++ b/test/extensions/filters/http/router/config_test.cc @@ -4,9 +4,9 @@ #include "extensions/filters/http/router/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/http/squash/config_test.cc b/test/extensions/filters/http/squash/config_test.cc index 278cd0e50996a..71e0828690c71 100644 --- a/test/extensions/filters/http/squash/config_test.cc +++ b/test/extensions/filters/http/squash/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/http/squash/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/http/squash/squash_filter_integration_test.cc b/test/extensions/filters/http/squash/squash_filter_integration_test.cc index af6823c1f963b..1ad01eb2283dc 100644 --- a/test/extensions/filters/http/squash/squash_filter_integration_test.cc +++ b/test/extensions/filters/http/squash/squash_filter_integration_test.cc @@ -17,7 +17,7 @@ using Envoy::Protobuf::util::MessageDifferencer; namespace Envoy { class SquashFilterIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: SquashFilterIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/extensions/filters/http/squash/squash_filter_test.cc b/test/extensions/filters/http/squash/squash_filter_test.cc index c7f2c7fcf4e86..f9289e3269bd9 100644 --- a/test/extensions/filters/http/squash/squash_filter_test.cc +++ b/test/extensions/filters/http/squash/squash_filter_test.cc @@ -11,11 +11,11 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "fmt/format.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -164,7 +164,7 @@ TEST(SoloFilterConfigTest, ParsesEnvironmentInComplexTemplate) { EXPECT_JSON_EQ(expected_json, config.attachmentJson()); } -class SquashFilterTest : public testing::Test { +class SquashFilterTest : public TestBase { public: SquashFilterTest() : request_(&cm_.async_client_) {} 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 26a79ea9c5c83..ca0a9b36ff554 100644 --- a/test/extensions/filters/http/tap/tap_filter_integration_test.cc +++ b/test/extensions/filters/http/tap/tap_filter_integration_test.cc @@ -1,15 +1,15 @@ #include "envoy/data/tap/v2alpha/wrapper.pb.h" #include "test/integration/http_integration.h" +#include "test/test_common/test_base.h" #include "absl/strings/match.h" -#include "gtest/gtest.h" namespace Envoy { namespace { class TapIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: TapIntegrationTest() // Note: This test must use HTTP/2 because of the lack of early close detection for diff --git a/test/extensions/filters/http/tap/tap_filter_test.cc b/test/extensions/filters/http/tap/tap_filter_test.cc index e48e13fd94fce..57a05df9a9daa 100644 --- a/test/extensions/filters/http/tap/tap_filter_test.cc +++ b/test/extensions/filters/http/tap/tap_filter_test.cc @@ -2,10 +2,10 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/stream_info/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::InSequence; using testing::Return; @@ -42,7 +42,7 @@ class MockHttpPerRequestTapper : public HttpPerRequestTapper { const Http::HeaderMap* response_headers)); }; -class TapFilterTest : public testing::Test { +class TapFilterTest : public TestBase { public: void setup(bool has_config) { if (has_config) { diff --git a/test/extensions/filters/listener/original_src/config_test.cc b/test/extensions/filters/listener/original_src/config_test.cc index 4efe2c2c0f673..59f0e483f857a 100644 --- a/test/extensions/filters/listener/original_src/config_test.cc +++ b/test/extensions/filters/listener/original_src/config_test.cc @@ -5,7 +5,7 @@ #include "extensions/filters/listener/original_src/config.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { @@ -15,7 +15,7 @@ namespace { // In keeping with the class under test, it would have made sense to call this ConfigTest. However, // when running coverage tests, that conflicts with tests elsewhere in the codebase. -class OriginalSrcConfigTest : public testing::Test { +class OriginalSrcConfigTest : public TestBase { public: Config makeConfigFromProto( const envoy::config::filter::listener::original_src::v2alpha1::OriginalSrc& proto_config) { diff --git a/test/extensions/filters/listener/original_src/original_src_config_factory_test.cc b/test/extensions/filters/listener/original_src/original_src_config_factory_test.cc index 5fe8755dce72e..4ef3c0735373b 100644 --- a/test/extensions/filters/listener/original_src/original_src_config_factory_test.cc +++ b/test/extensions/filters/listener/original_src/original_src_config_factory_test.cc @@ -6,9 +6,9 @@ #include "extensions/filters/listener/original_src/original_src_config_factory.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::Invoke; diff --git a/test/extensions/filters/listener/original_src/original_src_socket_option_test.cc b/test/extensions/filters/listener/original_src/original_src_socket_option_test.cc index 98e0c8c71a973..fdf555e7f4041 100644 --- a/test/extensions/filters/listener/original_src/original_src_socket_option_test.cc +++ b/test/extensions/filters/listener/original_src/original_src_socket_option_test.cc @@ -7,9 +7,9 @@ #include "test/mocks/common.h" #include "test/mocks/network/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Eq; @@ -20,7 +20,7 @@ namespace ListenerFilters { namespace OriginalSrc { namespace { -class OriginalSrcSocketOptionTest : public testing::Test { +class OriginalSrcSocketOptionTest : public TestBase { public: std::unique_ptr makeOptionByAddress(const Network::Address::InstanceConstSharedPtr& address) { diff --git a/test/extensions/filters/listener/original_src/original_src_test.cc b/test/extensions/filters/listener/original_src/original_src_test.cc index 23b5f700248b4..c76dd4ee6a4fd 100644 --- a/test/extensions/filters/listener/original_src/original_src_test.cc +++ b/test/extensions/filters/listener/original_src/original_src_test.cc @@ -10,9 +10,9 @@ #include "test/mocks/common.h" #include "test/mocks/network/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Exactly; @@ -24,7 +24,7 @@ namespace ListenerFilters { namespace OriginalSrc { namespace { -class OriginalSrcTest : public testing::Test { +class OriginalSrcTest : public TestBase { public: std::unique_ptr makeDefaultFilter() { Config default_config; diff --git a/test/extensions/filters/listener/proxy_protocol/proxy_protocol_test.cc b/test/extensions/filters/listener/proxy_protocol/proxy_protocol_test.cc index 6420a10e21384..50fae0a437564 100644 --- a/test/extensions/filters/listener/proxy_protocol/proxy_protocol_test.cc +++ b/test/extensions/filters/listener/proxy_protocol/proxy_protocol_test.cc @@ -22,12 +22,12 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -44,7 +44,7 @@ namespace ProxyProtocol { // Build again on the basis of the connection_handler_test.cc -class ProxyProtocolTest : public testing::TestWithParam, +class ProxyProtocolTest : public TestBaseWithParam, public Network::ListenerConfig, public Network::FilterChainManager, protected Logger::Loggable { @@ -865,7 +865,7 @@ TEST_P(ProxyProtocolTest, ClosedEmpty) { dispatcher_.run(Event::Dispatcher::RunType::NonBlock); } -class WildcardProxyProtocolTest : public testing::TestWithParam, +class WildcardProxyProtocolTest : public TestBaseWithParam, public Network::ListenerConfig, public Network::FilterChainManager, protected Logger::Loggable { diff --git a/test/extensions/filters/listener/tls_inspector/tls_inspector_benchmark.cc b/test/extensions/filters/listener/tls_inspector/tls_inspector_benchmark.cc index f2bc9964595d2..880edc3066fd0 100644 --- a/test/extensions/filters/listener/tls_inspector/tls_inspector_benchmark.cc +++ b/test/extensions/filters/listener/tls_inspector/tls_inspector_benchmark.cc @@ -9,10 +9,10 @@ #include "test/mocks/api/mocks.h" #include "test/mocks/network/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "benchmark/benchmark.h" -#include "gtest/gtest.h" #include "openssl/ssl.h" using testing::_; diff --git a/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc b/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc index a5a8fe37a726c..d51d1d9fa4418 100644 --- a/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc +++ b/test/extensions/filters/listener/tls_inspector/tls_inspector_test.cc @@ -6,9 +6,9 @@ #include "test/mocks/api/mocks.h" #include "test/mocks/network/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" -#include "gtest/gtest.h" #include "openssl/ssl.h" using testing::_; @@ -28,7 +28,7 @@ namespace Extensions { namespace ListenerFilters { namespace TlsInspector { -class TlsInspectorTest : public testing::Test { +class TlsInspectorTest : public TestBase { public: TlsInspectorTest() : cfg_(std::make_shared(store_)), diff --git a/test/extensions/filters/network/client_ssl_auth/client_ssl_auth_test.cc b/test/extensions/filters/network/client_ssl_auth/client_ssl_auth_test.cc index dce254914ad3d..2c6a78b380ac8 100644 --- a/test/extensions/filters/network/client_ssl_auth/client_ssl_auth_test.cc +++ b/test/extensions/filters/network/client_ssl_auth/client_ssl_auth_test.cc @@ -15,10 +15,10 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -55,7 +55,7 @@ TEST(ClientSslAuthConfigTest, BadClientSslAuthConfig) { Json::Exception); } -class ClientSslAuthFilterTest : public testing::Test { +class ClientSslAuthFilterTest : public TestBase { protected: ClientSslAuthFilterTest() : request_(&cm_.async_client_), interval_timer_(new Event::MockTimer(&dispatcher_)), diff --git a/test/extensions/filters/network/client_ssl_auth/config_test.cc b/test/extensions/filters/network/client_ssl_auth/config_test.cc index f25758b1b3cbd..bca273c01dd59 100644 --- a/test/extensions/filters/network/client_ssl_auth/config_test.cc +++ b/test/extensions/filters/network/client_ssl_auth/config_test.cc @@ -6,9 +6,9 @@ #include "extensions/filters/network/well_known_names.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; @@ -17,7 +17,7 @@ namespace Extensions { namespace NetworkFilters { namespace ClientSslAuth { -class IpWhiteListConfigTest : public ::testing::TestWithParam {}; +class IpWhiteListConfigTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpList, IpWhiteListConfigTest, ::testing::Values(R"EOF(["192.168.3.0/24"])EOF", diff --git a/test/extensions/filters/network/dubbo_proxy/config_test.cc b/test/extensions/filters/network/dubbo_proxy/config_test.cc index 11e5e3f5ef018..fd21b7c409791 100644 --- a/test/extensions/filters/network/dubbo_proxy/config_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/network/dubbo_proxy/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/network/dubbo_proxy/dubbo_protocol_impl_test.cc b/test/extensions/filters/network/dubbo_proxy/dubbo_protocol_impl_test.cc index 44ba352e6e003..387b25bab2417 100644 --- a/test/extensions/filters/network/dubbo_proxy/dubbo_protocol_impl_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/dubbo_protocol_impl_test.cc @@ -4,10 +4,10 @@ #include "test/extensions/filters/network/dubbo_proxy/mocks.h" #include "test/extensions/filters/network/dubbo_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/filters/network/dubbo_proxy/filter_test.cc b/test/extensions/filters/network/dubbo_proxy/filter_test.cc index 024224ce63358..32eda7490e800 100644 --- a/test/extensions/filters/network/dubbo_proxy/filter_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/filter_test.cc @@ -10,9 +10,9 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; @@ -25,7 +25,7 @@ using ConfigProtocolType = envoy::config::filter::network::dubbo_proxy::v2alpha1 using ConfigSerializationType = envoy::config::filter::network::dubbo_proxy::v2alpha1::SerializationType; -class DubboFilterTest : public testing::Test { +class DubboFilterTest : public TestBase { public: DubboFilterTest() {} diff --git a/test/extensions/filters/network/dubbo_proxy/hessian_deserializer_impl_test.cc b/test/extensions/filters/network/dubbo_proxy/hessian_deserializer_impl_test.cc index a2c5b22a08c86..370ab9c1c5880 100644 --- a/test/extensions/filters/network/dubbo_proxy/hessian_deserializer_impl_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/hessian_deserializer_impl_test.cc @@ -3,10 +3,10 @@ #include "test/extensions/filters/network/dubbo_proxy/mocks.h" #include "test/extensions/filters/network/dubbo_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NotNull; diff --git a/test/extensions/filters/network/dubbo_proxy/hessian_utils_test.cc b/test/extensions/filters/network/dubbo_proxy/hessian_utils_test.cc index dfb721f30f4be..080e61e8f5c8f 100644 --- a/test/extensions/filters/network/dubbo_proxy/hessian_utils_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/hessian_utils_test.cc @@ -3,10 +3,9 @@ #include "extensions/filters/network/dubbo_proxy/hessian_utils.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { diff --git a/test/extensions/filters/network/dubbo_proxy/metadata_test.cc b/test/extensions/filters/network/dubbo_proxy/metadata_test.cc index f89179cd637cb..8340941610369 100644 --- a/test/extensions/filters/network/dubbo_proxy/metadata_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/metadata_test.cc @@ -1,6 +1,6 @@ #include "extensions/filters/network/dubbo_proxy/metadata.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/filters/network/dubbo_proxy/mocks.cc b/test/extensions/filters/network/dubbo_proxy/mocks.cc index 2075536058f46..2cc0a101e242a 100644 --- a/test/extensions/filters/network/dubbo_proxy/mocks.cc +++ b/test/extensions/filters/network/dubbo_proxy/mocks.cc @@ -4,7 +4,7 @@ #include "common/protobuf/utility.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/network/dubbo_proxy/route_matcher_test.cc b/test/extensions/filters/network/dubbo_proxy/route_matcher_test.cc index ebf53c63914e9..b5e8df89812fa 100644 --- a/test/extensions/filters/network/dubbo_proxy/route_matcher_test.cc +++ b/test/extensions/filters/network/dubbo_proxy/route_matcher_test.cc @@ -7,7 +7,7 @@ #include "extensions/filters/network/dubbo_proxy/router/route_matcher.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/filters/network/ext_authz/config_test.cc b/test/extensions/filters/network/ext_authz/config_test.cc index 2d955119a1a77..8ae3c47dd39fd 100644 --- a/test/extensions/filters/network/ext_authz/config_test.cc +++ b/test/extensions/filters/network/ext_authz/config_test.cc @@ -4,9 +4,9 @@ #include "extensions/filters/network/ext_authz/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/network/ext_authz/ext_authz_test.cc b/test/extensions/filters/network/ext_authz/ext_authz_test.cc index e334b75a46499..06440f8d8a14b 100644 --- a/test/extensions/filters/network/ext_authz/ext_authz_test.cc +++ b/test/extensions/filters/network/ext_authz/ext_authz_test.cc @@ -18,9 +18,9 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -35,7 +35,7 @@ namespace Extensions { namespace NetworkFilters { namespace ExtAuthz { -class ExtAuthzFilterTest : public testing::Test { +class ExtAuthzFilterTest : public TestBase { public: ExtAuthzFilterTest() { std::string json = R"EOF( diff --git a/test/extensions/filters/network/http_connection_manager/config_test.cc b/test/extensions/filters/network/http_connection_manager/config_test.cc index 8f1cbb7b16d6e..4fe6b5d7cc92d 100644 --- a/test/extensions/filters/network/http_connection_manager/config_test.cc +++ b/test/extensions/filters/network/http_connection_manager/config_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ContainerEq; @@ -43,7 +43,7 @@ parseHttpConnectionManagerFromV2Yaml(const std::string& yaml) { return http_connection_manager; } -class HttpConnectionManagerConfigTest : public testing::Test { +class HttpConnectionManagerConfigTest : public TestBase { public: NiceMock context_; Http::SlowDateProviderImpl date_provider_{context_.dispatcher().timeSystem()}; diff --git a/test/extensions/filters/network/mongo_proxy/bson_impl_test.cc b/test/extensions/filters/network/mongo_proxy/bson_impl_test.cc index 9bbe1a1bbc660..df3afaf5ccbaa 100644 --- a/test/extensions/filters/network/mongo_proxy/bson_impl_test.cc +++ b/test/extensions/filters/network/mongo_proxy/bson_impl_test.cc @@ -5,8 +5,7 @@ #include "extensions/filters/network/mongo_proxy/bson_impl.h" #include "test/test_common/printers.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc b/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc index 350af0c22f4a9..231ec814ef4e5 100644 --- a/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc +++ b/test/extensions/filters/network/mongo_proxy/codec_impl_test.cc @@ -7,9 +7,9 @@ #include "extensions/filters/network/mongo_proxy/codec_impl.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::Eq; using testing::NiceMock; @@ -41,7 +41,7 @@ class TestDecoderCallbacks : public DecoderCallbacks { MOCK_METHOD1(decodeCommandReply_, void(CommandReplyMessagePtr& message)); }; -class MongoCodecImplTest : public testing::Test { +class MongoCodecImplTest : public TestBase { public: Buffer::OwnedImpl output_; EncoderImpl encoder_{output_}; diff --git a/test/extensions/filters/network/mongo_proxy/config_test.cc b/test/extensions/filters/network/mongo_proxy/config_test.cc index 2c2c20379b695..b830022b6c24a 100644 --- a/test/extensions/filters/network/mongo_proxy/config_test.cc +++ b/test/extensions/filters/network/mongo_proxy/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/network/mongo_proxy/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/network/mongo_proxy/proxy_test.cc b/test/extensions/filters/network/mongo_proxy/proxy_test.cc index 740bc4fc32c1f..63dddf1a4194e 100644 --- a/test/extensions/filters/network/mongo_proxy/proxy_test.cc +++ b/test/extensions/filters/network/mongo_proxy/proxy_test.cc @@ -18,9 +18,9 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/runtime/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -60,7 +60,7 @@ class TestProxyFilter : public ProxyFilter { DecoderCallbacks* callbacks_{}; }; -class MongoProxyFilterTest : public testing::Test { +class MongoProxyFilterTest : public TestBase { public: MongoProxyFilterTest() { setup(); } diff --git a/test/extensions/filters/network/mongo_proxy/utility_test.cc b/test/extensions/filters/network/mongo_proxy/utility_test.cc index d297f9394c8b4..f15524711c82e 100644 --- a/test/extensions/filters/network/mongo_proxy/utility_test.cc +++ b/test/extensions/filters/network/mongo_proxy/utility_test.cc @@ -4,7 +4,7 @@ #include "extensions/filters/network/mongo_proxy/codec_impl.h" #include "extensions/filters/network/mongo_proxy/utility.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/filters/network/mysql_proxy/mysql_codec_test.cc b/test/extensions/filters/network/mysql_proxy/mysql_codec_test.cc index 97a17d4b96a9f..e724eb6011990 100644 --- a/test/extensions/filters/network/mysql_proxy/mysql_codec_test.cc +++ b/test/extensions/filters/network/mysql_proxy/mysql_codec_test.cc @@ -5,8 +5,9 @@ #include "extensions/filters/network/mysql_proxy/mysql_codec_greeting.h" #include "extensions/filters/network/mysql_proxy/mysql_utils.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "mysql_test_utils.h" namespace Envoy { @@ -19,7 +20,7 @@ constexpr int MYSQL_UT_LAST_ID = 0; constexpr int MYSQL_UT_SERVER_OK = 0; constexpr int MYSQL_UT_SERVER_WARNINGS = 0x0001; -class MySQLCodecTest : public MySQLTestUtils, public testing::Test { +class MySQLCodecTest : public MySQLTestUtils, public TestBase { protected: uint64_t offset_{0}; }; diff --git a/test/extensions/filters/network/mysql_proxy/mysql_command_test.cc b/test/extensions/filters/network/mysql_proxy/mysql_command_test.cc index a0c6ca81d7f8a..ce6cc1795045f 100644 --- a/test/extensions/filters/network/mysql_proxy/mysql_command_test.cc +++ b/test/extensions/filters/network/mysql_proxy/mysql_command_test.cc @@ -5,8 +5,9 @@ #include "extensions/filters/network/mysql_proxy/mysql_codec_greeting.h" #include "extensions/filters/network/mysql_proxy/mysql_utils.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "include/sqlparser/SQLParser.h" #include "mysql_test_utils.h" @@ -15,7 +16,7 @@ namespace Extensions { namespace NetworkFilters { namespace MySQLProxy { -class MySQLCommandTest : public MySQLTestUtils, public testing::Test { +class MySQLCommandTest : public MySQLTestUtils, public TestBase { public: int encodeQuery(std::string query, hsql::SQLParserResult& result) { Command mysql_cmd_encode{}; diff --git a/test/extensions/filters/network/mysql_proxy/mysql_filter_test.cc b/test/extensions/filters/network/mysql_proxy/mysql_filter_test.cc index 11e6e1c335ae6..cd5e80a547f5e 100644 --- a/test/extensions/filters/network/mysql_proxy/mysql_filter_test.cc +++ b/test/extensions/filters/network/mysql_proxy/mysql_filter_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/network/mysql_proxy/mysql_utils.h" #include "test/mocks/network/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "mysql_test_utils.h" using testing::NiceMock; @@ -17,7 +17,7 @@ namespace MySQLProxy { constexpr int SESSIONS = 5; -class MySQLFilterTest : public MySQLTestUtils, public testing::Test { +class MySQLFilterTest : public MySQLTestUtils, public TestBase { public: MySQLFilterTest() { ENVOY_LOG_MISC(info, "test"); } diff --git a/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc b/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc index 02e72eb07cb06..0c5adcb1691c9 100644 --- a/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc +++ b/test/extensions/filters/network/mysql_proxy/mysql_integration_test.cc @@ -11,9 +11,9 @@ #include "test/integration/utility.h" #include "test/mocks/network/mocks.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "mysql_test_utils.h" #include "rapidjson/document.h" @@ -28,7 +28,7 @@ constexpr int SESSIONS = 5; class MySQLIntegrationTest : public MySQLTestUtils, public BaseIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { std::string mysqlConfig() { return TestEnvironment::readFileToStringForTest(TestEnvironment::runfilesPath( "test/extensions/filters/network/mysql_proxy/mysql_test_config.yaml")); diff --git a/test/extensions/filters/network/ratelimit/config_test.cc b/test/extensions/filters/network/ratelimit/config_test.cc index c15553fa49db2..1019092538dcb 100644 --- a/test/extensions/filters/network/ratelimit/config_test.cc +++ b/test/extensions/filters/network/ratelimit/config_test.cc @@ -6,9 +6,9 @@ #include "extensions/filters/network/ratelimit/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ReturnRef; diff --git a/test/extensions/filters/network/ratelimit/ratelimit_test.cc b/test/extensions/filters/network/ratelimit/ratelimit_test.cc index eb6b9ee4db80c..2d3babd20ddd7 100644 --- a/test/extensions/filters/network/ratelimit/ratelimit_test.cc +++ b/test/extensions/filters/network/ratelimit/ratelimit_test.cc @@ -16,9 +16,9 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/tracing/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -32,7 +32,7 @@ namespace Extensions { namespace NetworkFilters { namespace RateLimitFilter { -class RateLimitFilterTest : public testing::Test { +class RateLimitFilterTest : public TestBase { public: RateLimitFilterTest() {} diff --git a/test/extensions/filters/network/rbac/config_test.cc b/test/extensions/filters/network/rbac/config_test.cc index 3479f43d032a4..62e1bc9bde113 100644 --- a/test/extensions/filters/network/rbac/config_test.cc +++ b/test/extensions/filters/network/rbac/config_test.cc @@ -3,10 +3,10 @@ #include "extensions/filters/network/rbac/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "fmt/printf.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -23,7 +23,7 @@ const std::string header = R"EOF( } // namespace -class RoleBasedAccessControlNetworkFilterConfigFactoryTest : public testing::Test { +class RoleBasedAccessControlNetworkFilterConfigFactoryTest : public TestBase { public: void validateRule(const std::string& policy_json) { checkRule(fmt::sprintf(policy_json, header)); diff --git a/test/extensions/filters/network/rbac/filter_test.cc b/test/extensions/filters/network/rbac/filter_test.cc index feb084d5714c6..031db15b7aba3 100644 --- a/test/extensions/filters/network/rbac/filter_test.cc +++ b/test/extensions/filters/network/rbac/filter_test.cc @@ -17,7 +17,7 @@ namespace Extensions { namespace NetworkFilters { namespace RBACFilter { -class RoleBasedAccessControlNetworkFilterTest : public testing::Test { +class RoleBasedAccessControlNetworkFilterTest : public TestBase { public: RoleBasedAccessControlFilterConfigSharedPtr setupConfig(bool with_policy = true, bool continuous = false) { diff --git a/test/extensions/filters/network/rbac/integration_test.cc b/test/extensions/filters/network/rbac/integration_test.cc index 753eb2c7b6f22..2e1d83186b9b4 100644 --- a/test/extensions/filters/network/rbac/integration_test.cc +++ b/test/extensions/filters/network/rbac/integration_test.cc @@ -16,7 +16,7 @@ std::string rbac_config; class RoleBasedAccessControlNetworkFilterIntegrationTest : public BaseIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: RoleBasedAccessControlNetworkFilterIntegrationTest() : BaseIntegrationTest(GetParam(), realTime(), rbac_config) {} diff --git a/test/extensions/filters/network/redis_proxy/codec_impl_test.cc b/test/extensions/filters/network/redis_proxy/codec_impl_test.cc index 9ecf214707635..1a53711ac9df9 100644 --- a/test/extensions/filters/network/redis_proxy/codec_impl_test.cc +++ b/test/extensions/filters/network/redis_proxy/codec_impl_test.cc @@ -7,16 +7,15 @@ #include "test/extensions/filters/network/redis_proxy/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { namespace RedisProxy { -class RedisEncoderDecoderImplTest : public testing::Test, public DecoderCallbacks { +class RedisEncoderDecoderImplTest : public TestBase, public DecoderCallbacks { public: RedisEncoderDecoderImplTest() : decoder_(*this) {} diff --git a/test/extensions/filters/network/redis_proxy/command_splitter_impl_test.cc b/test/extensions/filters/network/redis_proxy/command_splitter_impl_test.cc index 2fc502a26ebfa..0e4b53d16eb2c 100644 --- a/test/extensions/filters/network/redis_proxy/command_splitter_impl_test.cc +++ b/test/extensions/filters/network/redis_proxy/command_splitter_impl_test.cc @@ -14,9 +14,9 @@ #include "test/mocks/stats/mocks.h" #include "test/test_common/printers.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ByRef; @@ -35,7 +35,7 @@ namespace NetworkFilters { namespace RedisProxy { namespace CommandSplitter { -class RedisCommandSplitterImplTest : public testing::Test { +class RedisCommandSplitterImplTest : public TestBase { public: void makeBulkStringArray(RespValue& value, const std::vector& strings) { std::vector values(strings.size()); diff --git a/test/extensions/filters/network/redis_proxy/config_test.cc b/test/extensions/filters/network/redis_proxy/config_test.cc index 074862e5718c8..ca5a7b5305cbd 100644 --- a/test/extensions/filters/network/redis_proxy/config_test.cc +++ b/test/extensions/filters/network/redis_proxy/config_test.cc @@ -5,9 +5,9 @@ #include "extensions/filters/network/redis_proxy/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; diff --git a/test/extensions/filters/network/redis_proxy/conn_pool_impl_test.cc b/test/extensions/filters/network/redis_proxy/conn_pool_impl_test.cc index eaa065ac28f9c..95f0d84dfa4de 100644 --- a/test/extensions/filters/network/redis_proxy/conn_pool_impl_test.cc +++ b/test/extensions/filters/network/redis_proxy/conn_pool_impl_test.cc @@ -11,9 +11,9 @@ #include "test/mocks/thread_local/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::DoAll; @@ -39,7 +39,7 @@ createConnPoolSettings() { return setting; } -class RedisClientImplTest : public testing::Test, public DecoderFactory { +class RedisClientImplTest : public TestBase, public DecoderFactory { public: // RedisProxy::DecoderFactory DecoderPtr create(DecoderCallbacks& callbacks) override { @@ -380,7 +380,7 @@ TEST(RedisClientFactoryImplTest, Basic) { client->close(); } -class RedisConnPoolImplTest : public testing::Test, public ClientFactory { +class RedisConnPoolImplTest : public TestBase, public ClientFactory { public: void setup(bool cluster_exists = true) { EXPECT_CALL(cm_, addThreadLocalClusterUpdateCallbacks_(_)) diff --git a/test/extensions/filters/network/redis_proxy/mocks.cc b/test/extensions/filters/network/redis_proxy/mocks.cc index c3283870c80d1..b18f0efed0e10 100644 --- a/test/extensions/filters/network/redis_proxy/mocks.cc +++ b/test/extensions/filters/network/redis_proxy/mocks.cc @@ -4,8 +4,9 @@ #include "common/common/assert.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/network/redis_proxy/proxy_filter_test.cc b/test/extensions/filters/network/redis_proxy/proxy_filter_test.cc index 9861b10e88f0f..b1a097f4386c7 100644 --- a/test/extensions/filters/network/redis_proxy/proxy_filter_test.cc +++ b/test/extensions/filters/network/redis_proxy/proxy_filter_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ByRef; @@ -40,7 +40,7 @@ parseProtoFromJson(const std::string& json_string) { return config; } -class RedisProxyFilterConfigTest : public testing::Test { +class RedisProxyFilterConfigTest : public TestBase { public: Stats::IsolatedStoreImpl store_; Network::MockDrainDecision drain_decision_; @@ -73,7 +73,7 @@ TEST_F(RedisProxyFilterConfigTest, BadRedisProxyConfig) { EXPECT_THROW(parseProtoFromJson(json_string), Json::Exception); } -class RedisProxyFilterTest : public testing::Test, public DecoderFactory { +class RedisProxyFilterTest : public TestBase, public DecoderFactory { public: RedisProxyFilterTest() { std::string json_string = R"EOF( diff --git a/test/extensions/filters/network/sni_cluster/sni_cluster_test.cc b/test/extensions/filters/network/sni_cluster/sni_cluster_test.cc index 9cc39bd6d2e61..4ce86542422d7 100644 --- a/test/extensions/filters/network/sni_cluster/sni_cluster_test.cc +++ b/test/extensions/filters/network/sni_cluster/sni_cluster_test.cc @@ -6,9 +6,9 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/server/mocks.h" #include "test/mocks/stream_info/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Matcher; diff --git a/test/extensions/filters/network/tcp_proxy/config_test.cc b/test/extensions/filters/network/tcp_proxy/config_test.cc index 542b4414044f0..5300b146f2df9 100644 --- a/test/extensions/filters/network/tcp_proxy/config_test.cc +++ b/test/extensions/filters/network/tcp_proxy/config_test.cc @@ -1,9 +1,9 @@ #include "extensions/filters/network/tcp_proxy/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; @@ -12,7 +12,7 @@ namespace Extensions { namespace NetworkFilters { namespace TcpProxy { -class RouteIpListConfigTest : public ::testing::TestWithParam {}; +class RouteIpListConfigTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpList, RouteIpListConfigTest, ::testing::Values(R"EOF("destination_ip_list": [ diff --git a/test/extensions/filters/network/thrift_proxy/app_exception_impl_test.cc b/test/extensions/filters/network/thrift_proxy/app_exception_impl_test.cc index 245ecd9423abb..c755f35a5a8e5 100644 --- a/test/extensions/filters/network/thrift_proxy/app_exception_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/app_exception_impl_test.cc @@ -3,9 +3,9 @@ #include "extensions/filters/network/thrift_proxy/app_exception_impl.h" #include "test/extensions/filters/network/thrift_proxy/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::InSequence; using testing::Ref; diff --git a/test/extensions/filters/network/thrift_proxy/auto_protocol_impl_test.cc b/test/extensions/filters/network/thrift_proxy/auto_protocol_impl_test.cc index ffb756103f0d3..93a61e1f4a186 100644 --- a/test/extensions/filters/network/thrift_proxy/auto_protocol_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/auto_protocol_impl_test.cc @@ -10,10 +10,10 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::Ref; @@ -25,7 +25,7 @@ namespace Extensions { namespace NetworkFilters { namespace ThriftProxy { -class AutoProtocolTest : public testing::Test { +class AutoProtocolTest : public TestBase { public: void resetMetadata() { metadata_.setMethodName("-"); diff --git a/test/extensions/filters/network/thrift_proxy/auto_transport_impl_test.cc b/test/extensions/filters/network/thrift_proxy/auto_transport_impl_test.cc index e451dbdd6f85f..ae5d12408aaa6 100644 --- a/test/extensions/filters/network/thrift_proxy/auto_transport_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/auto_transport_impl_test.cc @@ -7,10 +7,10 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::Ref; diff --git a/test/extensions/filters/network/thrift_proxy/binary_protocol_impl_test.cc b/test/extensions/filters/network/thrift_proxy/binary_protocol_impl_test.cc index a3ea1d80a0cbc..68052ae7abc21 100644 --- a/test/extensions/filters/network/thrift_proxy/binary_protocol_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/binary_protocol_impl_test.cc @@ -6,16 +6,15 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { namespace ThriftProxy { -class BinaryProtocolTest : public testing::Test { +class BinaryProtocolTest : public TestBase { public: void resetMetadata() { metadata_.setMethodName("-"); diff --git a/test/extensions/filters/network/thrift_proxy/buffer_helper_test.cc b/test/extensions/filters/network/thrift_proxy/buffer_helper_test.cc index 0f2a1b0cdb3ad..8cdcf8453b2d2 100644 --- a/test/extensions/filters/network/thrift_proxy/buffer_helper_test.cc +++ b/test/extensions/filters/network/thrift_proxy/buffer_helper_test.cc @@ -8,10 +8,9 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { diff --git a/test/extensions/filters/network/thrift_proxy/compact_protocol_impl_test.cc b/test/extensions/filters/network/thrift_proxy/compact_protocol_impl_test.cc index 4ceed3eec0281..70ba1cb05b9c9 100644 --- a/test/extensions/filters/network/thrift_proxy/compact_protocol_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/compact_protocol_impl_test.cc @@ -6,11 +6,9 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - -using testing::TestWithParam; using testing::Values; namespace Envoy { @@ -18,7 +16,7 @@ namespace Extensions { namespace NetworkFilters { namespace ThriftProxy { -class CompactProtocolTest : public testing::Test { +class CompactProtocolTest : public TestBase { public: void resetMetadata() { metadata_.setMethodName("-"); @@ -998,7 +996,7 @@ TEST_F(CompactProtocolTest, ReadBinary) { EXPECT_EQ(buffer.length(), 0); } -class CompactProtocolFieldTypeTest : public TestWithParam {}; +class CompactProtocolFieldTypeTest : public TestBaseWithParam {}; TEST_P(CompactProtocolFieldTypeTest, ConvertsToFieldType) { uint8_t compact_field_type = GetParam(); diff --git a/test/extensions/filters/network/thrift_proxy/config_test.cc b/test/extensions/filters/network/thrift_proxy/config_test.cc index 823c9ba56d057..df1765741e06b 100644 --- a/test/extensions/filters/network/thrift_proxy/config_test.cc +++ b/test/extensions/filters/network/thrift_proxy/config_test.cc @@ -6,9 +6,9 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; @@ -67,11 +67,11 @@ class ThriftFilterConfigTestBase { ThriftProxyFilterConfigFactory factory_; }; -class ThriftFilterConfigTest : public ThriftFilterConfigTestBase, public testing::Test {}; +class ThriftFilterConfigTest : public ThriftFilterConfigTestBase, public TestBase {}; class ThriftFilterTransportConfigTest : public ThriftFilterConfigTestBase, - public testing::TestWithParam< + public TestBaseWithParam< envoy::config::filter::network::thrift_proxy::v2alpha1::TransportType> {}; INSTANTIATE_TEST_SUITE_P(TransportTypes, ThriftFilterTransportConfigTest, @@ -79,7 +79,7 @@ INSTANTIATE_TEST_SUITE_P(TransportTypes, ThriftFilterTransportConfigTest, class ThriftFilterProtocolConfigTest : public ThriftFilterConfigTestBase, - public testing::TestWithParam< + public TestBaseWithParam< envoy::config::filter::network::thrift_proxy::v2alpha1::ProtocolType> {}; INSTANTIATE_TEST_SUITE_P(ProtocolTypes, ThriftFilterProtocolConfigTest, diff --git a/test/extensions/filters/network/thrift_proxy/conn_manager_test.cc b/test/extensions/filters/network/thrift_proxy/conn_manager_test.cc index fc5d156b3ccac..45dfc7e78b85e 100644 --- a/test/extensions/filters/network/thrift_proxy/conn_manager_test.cc +++ b/test/extensions/filters/network/thrift_proxy/conn_manager_test.cc @@ -17,9 +17,9 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -70,7 +70,7 @@ class TestConfigImpl : public ConfigImpl { MockProtocol* protocol_{}; }; -class ThriftConnectionManagerTest : public testing::Test { +class ThriftConnectionManagerTest : public TestBase { public: ThriftConnectionManagerTest() : stats_(ThriftFilterStats::generateStats("test.", store_)) {} ~ThriftConnectionManagerTest() { diff --git a/test/extensions/filters/network/thrift_proxy/conn_state_test.cc b/test/extensions/filters/network/thrift_proxy/conn_state_test.cc index 5a875e9cc9875..63d71848e9e35 100644 --- a/test/extensions/filters/network/thrift_proxy/conn_state_test.cc +++ b/test/extensions/filters/network/thrift_proxy/conn_state_test.cc @@ -1,6 +1,6 @@ #include "extensions/filters/network/thrift_proxy/conn_state.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/filters/network/thrift_proxy/decoder_test.cc b/test/extensions/filters/network/thrift_proxy/decoder_test.cc index ad2670c1af21c..8cfa92bc37433 100644 --- a/test/extensions/filters/network/thrift_proxy/decoder_test.cc +++ b/test/extensions/filters/network/thrift_proxy/decoder_test.cc @@ -6,11 +6,11 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/string_view.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AnyNumber; @@ -26,8 +26,7 @@ using testing::Return; using testing::ReturnRef; using testing::SetArgReferee; using testing::StrictMock; -using testing::TestParamInfo; -using testing::TestWithParam; +using ::testing::TestParamInfo; using testing::Values; namespace Envoy { @@ -190,7 +189,7 @@ class DecoderStateMachineTestBase { }; class DecoderStateMachineNonValueTest : public DecoderStateMachineTestBase, - public TestWithParam {}; + public TestBaseWithParam {}; static std::string protoStateParamToString(const TestParamInfo& params) { return ProtocolStateNameValues::name(params.param); @@ -205,10 +204,10 @@ INSTANTIATE_TEST_SUITE_P(NonValueProtocolStates, DecoderStateMachineNonValueTest ProtocolState::SetBegin, ProtocolState::SetEnd), protoStateParamToString); -class DecoderStateMachineTest : public DecoderStateMachineTestBase, public testing::Test {}; +class DecoderStateMachineTest : public DecoderStateMachineTestBase, public TestBase {}; class DecoderStateMachineValueTest : public DecoderStateMachineTestBase, - public TestWithParam {}; + public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(PrimitiveFieldTypes, DecoderStateMachineValueTest, Values(FieldType::Bool, FieldType::Byte, FieldType::Double, FieldType::I16, @@ -217,7 +216,7 @@ INSTANTIATE_TEST_SUITE_P(PrimitiveFieldTypes, DecoderStateMachineValueTest, class DecoderStateMachineNestingTest : public DecoderStateMachineTestBase, - public TestWithParam> {}; + public TestBaseWithParam> {}; static std::string nestedFieldTypesParamToString( const TestParamInfo>& params) { diff --git a/test/extensions/filters/network/thrift_proxy/filters/ratelimit/config_test.cc b/test/extensions/filters/network/thrift_proxy/filters/ratelimit/config_test.cc index 93ad98c5202dc..d3913a8c2f3e7 100644 --- a/test/extensions/filters/network/thrift_proxy/filters/ratelimit/config_test.cc +++ b/test/extensions/filters/network/thrift_proxy/filters/ratelimit/config_test.cc @@ -5,9 +5,9 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ReturnRef; diff --git a/test/extensions/filters/network/thrift_proxy/filters/ratelimit/ratelimit_test.cc b/test/extensions/filters/network/thrift_proxy/filters/ratelimit/ratelimit_test.cc index 76ec64e8ab1c6..06fbdd7c47763 100644 --- a/test/extensions/filters/network/thrift_proxy/filters/ratelimit/ratelimit_test.cc +++ b/test/extensions/filters/network/thrift_proxy/filters/ratelimit/ratelimit_test.cc @@ -18,10 +18,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -39,7 +39,7 @@ namespace RateLimitFilter { using namespace Envoy::Extensions::NetworkFilters; -class ThriftRateLimitFilterTest : public testing::Test { +class ThriftRateLimitFilterTest : public TestBase { public: ThriftRateLimitFilterTest() { ON_CALL(runtime_.snapshot_, featureEnabled("ratelimit.thrift_filter_enabled", 100)) diff --git a/test/extensions/filters/network/thrift_proxy/framed_transport_impl_test.cc b/test/extensions/filters/network/thrift_proxy/framed_transport_impl_test.cc index f3afa26d2f101..ff4401140cdca 100644 --- a/test/extensions/filters/network/thrift_proxy/framed_transport_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/framed_transport_impl_test.cc @@ -6,10 +6,9 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { diff --git a/test/extensions/filters/network/thrift_proxy/header_transport_impl_test.cc b/test/extensions/filters/network/thrift_proxy/header_transport_impl_test.cc index 3884eac7862db..83296dd6e9c0d 100644 --- a/test/extensions/filters/network/thrift_proxy/header_transport_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/header_transport_impl_test.cc @@ -8,10 +8,10 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/mocks/buffer/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::Return; diff --git a/test/extensions/filters/network/thrift_proxy/integration_test.cc b/test/extensions/filters/network/thrift_proxy/integration_test.cc index bfea576f2872b..afe0d34a869f6 100644 --- a/test/extensions/filters/network/thrift_proxy/integration_test.cc +++ b/test/extensions/filters/network/thrift_proxy/integration_test.cc @@ -3,12 +3,10 @@ #include "test/extensions/filters/network/thrift_proxy/integration.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::Combine; -using testing::TestParamInfo; -using testing::TestWithParam; +using ::testing::TestParamInfo; using testing::Values; namespace Envoy { @@ -18,7 +16,7 @@ namespace ThriftProxy { class ThriftConnManagerIntegrationTest : public BaseThriftIntegrationTest, - public TestWithParam> { + public TestBaseWithParam> { public: static void SetUpTestSuite() { thrift_config_ = ConfigHelper::BASE_CONFIG + R"EOF( diff --git a/test/extensions/filters/network/thrift_proxy/metadata_test.cc b/test/extensions/filters/network/thrift_proxy/metadata_test.cc index 17bd4a0aaeb8c..a4eb46415cc61 100644 --- a/test/extensions/filters/network/thrift_proxy/metadata_test.cc +++ b/test/extensions/filters/network/thrift_proxy/metadata_test.cc @@ -1,10 +1,9 @@ #include "extensions/filters/network/thrift_proxy/metadata.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { diff --git a/test/extensions/filters/network/thrift_proxy/mocks.cc b/test/extensions/filters/network/thrift_proxy/mocks.cc index e32c0a6547820..fa4b6c13301b1 100644 --- a/test/extensions/filters/network/thrift_proxy/mocks.cc +++ b/test/extensions/filters/network/thrift_proxy/mocks.cc @@ -2,7 +2,7 @@ #include "common/protobuf/protobuf.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::_; using testing::Invoke; diff --git a/test/extensions/filters/network/thrift_proxy/route_matcher_test.cc b/test/extensions/filters/network/thrift_proxy/route_matcher_test.cc index 274285884f04e..8025b5ecf1457 100644 --- a/test/extensions/filters/network/thrift_proxy/route_matcher_test.cc +++ b/test/extensions/filters/network/thrift_proxy/route_matcher_test.cc @@ -5,10 +5,9 @@ #include "extensions/filters/network/thrift_proxy/router/router_impl.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::_; namespace Envoy { diff --git a/test/extensions/filters/network/thrift_proxy/router_ratelimit_test.cc b/test/extensions/filters/network/thrift_proxy/router_ratelimit_test.cc index 92b2a3be00ce8..9bd8bda646899 100644 --- a/test/extensions/filters/network/thrift_proxy/router_ratelimit_test.cc +++ b/test/extensions/filters/network/thrift_proxy/router_ratelimit_test.cc @@ -13,9 +13,9 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/mocks/ratelimit/mocks.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::ContainerEq; using testing::NiceMock; @@ -27,7 +27,7 @@ namespace ThriftProxy { namespace Router { namespace { -class ThriftRateLimitConfigurationTest : public testing::Test { +class ThriftRateLimitConfigurationTest : public TestBase { public: void initialize(const std::string& yaml) { envoy::config::filter::network::thrift_proxy::v2alpha1::ThriftProxy config; @@ -168,7 +168,7 @@ TEST_F(ThriftRateLimitConfigurationTest, Stages) { EXPECT_TRUE(rate_limits.empty()); } -class ThriftRateLimitPolicyEntryTest : public testing::Test { +class ThriftRateLimitPolicyEntryTest : public TestBase { public: void initialize(const std::string yaml) { envoy::api::v2::route::RateLimit rate_limit; diff --git a/test/extensions/filters/network/thrift_proxy/router_test.cc b/test/extensions/filters/network/thrift_proxy/router_test.cc index 8082baed3f713..082328dfad5d0 100644 --- a/test/extensions/filters/network/thrift_proxy/router_test.cc +++ b/test/extensions/filters/network/thrift_proxy/router_test.cc @@ -17,9 +17,9 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ContainsRegex; @@ -29,7 +29,6 @@ using testing::NiceMock; using testing::Ref; using testing::Return; using testing::ReturnRef; -using testing::TestWithParam; using testing::Values; namespace Envoy { @@ -329,11 +328,11 @@ class ThriftRouterTestBase { NiceMock upstream_connection_; }; -class ThriftRouterTest : public ThriftRouterTestBase, public testing::Test { +class ThriftRouterTest : public ThriftRouterTestBase, public TestBase { public: }; -class ThriftRouterFieldTypeTest : public ThriftRouterTestBase, public TestWithParam { +class ThriftRouterFieldTypeTest : public ThriftRouterTestBase, public TestBaseWithParam { public: }; @@ -342,7 +341,7 @@ INSTANTIATE_TEST_SUITE_P(PrimitiveFieldTypes, ThriftRouterFieldTypeTest, FieldType::I64, FieldType::Double, FieldType::String), fieldTypeParamToString); -class ThriftRouterContainerTest : public ThriftRouterTestBase, public TestWithParam { +class ThriftRouterContainerTest : public ThriftRouterTestBase, public TestBaseWithParam { public: }; diff --git a/test/extensions/filters/network/thrift_proxy/thrift_object_impl_test.cc b/test/extensions/filters/network/thrift_proxy/thrift_object_impl_test.cc index f0df6641e6bc4..6b209fcc54bd7 100644 --- a/test/extensions/filters/network/thrift_proxy/thrift_object_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/thrift_object_impl_test.cc @@ -5,10 +5,10 @@ #include "test/extensions/filters/network/thrift_proxy/mocks.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::AnyNumber; using testing::Expectation; @@ -18,7 +18,6 @@ using testing::NiceMock; using testing::Ref; using testing::Return; using testing::ReturnRef; -using testing::TestWithParam; using testing::Values; namespace Envoy { @@ -143,7 +142,7 @@ class ThriftObjectImplTestBase { Buffer::OwnedImpl buffer_; }; -class ThriftObjectImplTest : public ThriftObjectImplTestBase, public testing::Test {}; +class ThriftObjectImplTest : public ThriftObjectImplTestBase, public TestBase {}; // Test parsing an empty struct (just a stop field). TEST_F(ThriftObjectImplTest, ParseEmptyStruct) { @@ -163,7 +162,7 @@ TEST_F(ThriftObjectImplTest, ParseEmptyStruct) { } class ThriftObjectImplValueTest : public ThriftObjectImplTestBase, - public TestWithParam {}; + public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(PrimitiveFieldTypes, ThriftObjectImplValueTest, Values(FieldType::Bool, FieldType::Byte, FieldType::Double, FieldType::I16, diff --git a/test/extensions/filters/network/thrift_proxy/translation_integration_test.cc b/test/extensions/filters/network/thrift_proxy/translation_integration_test.cc index 6997d9345ce01..3db1c54e6ba71 100644 --- a/test/extensions/filters/network/thrift_proxy/translation_integration_test.cc +++ b/test/extensions/filters/network/thrift_proxy/translation_integration_test.cc @@ -5,12 +5,10 @@ #include "test/extensions/filters/network/thrift_proxy/integration.h" #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::Combine; -using testing::TestParamInfo; -using testing::TestWithParam; +using ::testing::TestParamInfo; using testing::Values; namespace Envoy { @@ -20,7 +18,8 @@ namespace ThriftProxy { class ThriftTranslationIntegrationTest : public BaseThriftIntegrationTest, - public TestWithParam> { + public TestBaseWithParam< + std::tuple> { public: static void SetUpTestSuite() { thrift_config_ = ConfigHelper::BASE_CONFIG + R"EOF( diff --git a/test/extensions/filters/network/thrift_proxy/twitter_protocol_impl_test.cc b/test/extensions/filters/network/thrift_proxy/twitter_protocol_impl_test.cc index 5b1b77b9ae78e..388ce5e5fa7f8 100644 --- a/test/extensions/filters/network/thrift_proxy/twitter_protocol_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/twitter_protocol_impl_test.cc @@ -7,10 +7,9 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { @@ -36,7 +35,7 @@ class TestTwitterProtocolImpl : public TwitterProtocolImpl { } }; -class TwitterProtocolTest : public testing::Test { +class TwitterProtocolTest : public TestBase { public: void clearMetadata() { metadata_.reset(new MessageMetadata()); } diff --git a/test/extensions/filters/network/thrift_proxy/unframed_transport_impl_test.cc b/test/extensions/filters/network/thrift_proxy/unframed_transport_impl_test.cc index 48097a6f1c2a6..564c3df40130e 100644 --- a/test/extensions/filters/network/thrift_proxy/unframed_transport_impl_test.cc +++ b/test/extensions/filters/network/thrift_proxy/unframed_transport_impl_test.cc @@ -4,10 +4,9 @@ #include "test/extensions/filters/network/thrift_proxy/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace NetworkFilters { diff --git a/test/extensions/filters/network/thrift_proxy/utility.h b/test/extensions/filters/network/thrift_proxy/utility.h index d4fd19bb537e2..3843375925766 100644 --- a/test/extensions/filters/network/thrift_proxy/utility.h +++ b/test/extensions/filters/network/thrift_proxy/utility.h @@ -10,12 +10,12 @@ #include "extensions/filters/network/thrift_proxy/thrift.h" #include "test/common/buffer/utility.h" +#include "test/test_common/test_base.h" #include "absl/strings/ascii.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" -using testing::TestParamInfo; +using ::testing::TestParamInfo; namespace Envoy { namespace Extensions { diff --git a/test/extensions/health_checkers/redis/redis_test.cc b/test/extensions/health_checkers/redis/redis_test.cc index 4e4f119c75c00..bf922be86ae5d 100644 --- a/test/extensions/health_checkers/redis/redis_test.cc +++ b/test/extensions/health_checkers/redis/redis_test.cc @@ -25,7 +25,7 @@ namespace HealthCheckers { namespace RedisHealthChecker { class RedisHealthCheckerTest - : public testing::Test, + : public TestBase, public Extensions::NetworkFilters::RedisProxy::ConnPool::ClientFactory { public: RedisHealthCheckerTest() diff --git a/test/extensions/quic_listeners/quiche/dummy_test.cc b/test/extensions/quic_listeners/quiche/dummy_test.cc index 1d454c41e6a91..1624fd52ff946 100644 --- a/test/extensions/quic_listeners/quiche/dummy_test.cc +++ b/test/extensions/quic_listeners/quiche/dummy_test.cc @@ -1,6 +1,7 @@ #include "extensions/quic_listeners/quiche/dummy.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" + #include "quiche/http2/platform/api/http2_string.h" namespace Envoy { diff --git a/test/extensions/quic_listeners/quiche/platform/http2_platform_test.cc b/test/extensions/quic_listeners/quiche/platform/http2_platform_test.cc index 788c0c53921ec..4f16a1a16442e 100644 --- a/test/extensions/quic_listeners/quiche/platform/http2_platform_test.cc +++ b/test/extensions/quic_listeners/quiche/platform/http2_platform_test.cc @@ -1,6 +1,7 @@ #include -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" + #include "quiche/http2/platform/api/http2_arraysize.h" #include "quiche/http2/platform/api/http2_containers.h" #include "quiche/http2/platform/api/http2_estimate_memory_usage.h" diff --git a/test/extensions/quic_listeners/quiche/platform/quic_platform_test.cc b/test/extensions/quic_listeners/quiche/platform/quic_platform_test.cc index 42d134e94e422..777796fa58b45 100644 --- a/test/extensions/quic_listeners/quiche/platform/quic_platform_test.cc +++ b/test/extensions/quic_listeners/quiche/platform/quic_platform_test.cc @@ -1,4 +1,5 @@ -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" + #include "quiche/quic/platform/api/quic_aligned.h" #include "quiche/quic/platform/api/quic_arraysize.h" #include "quiche/quic/platform/api/quic_containers.h" diff --git a/test/extensions/quic_listeners/quiche/platform/spdy_platform_test.cc b/test/extensions/quic_listeners/quiche/platform/spdy_platform_test.cc index 7e6ff7a6494b1..c2322424f53ea 100644 --- a/test/extensions/quic_listeners/quiche/platform/spdy_platform_test.cc +++ b/test/extensions/quic_listeners/quiche/platform/spdy_platform_test.cc @@ -1,6 +1,7 @@ #include -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" + #include "quiche/spdy/platform/api/spdy_arraysize.h" #include "quiche/spdy/platform/api/spdy_containers.h" #include "quiche/spdy/platform/api/spdy_endianness_util.h" diff --git a/test/extensions/resource_monitors/fixed_heap/config_test.cc b/test/extensions/resource_monitors/fixed_heap/config_test.cc index fb73abee200f8..edc9e54d44f68 100644 --- a/test/extensions/resource_monitors/fixed_heap/config_test.cc +++ b/test/extensions/resource_monitors/fixed_heap/config_test.cc @@ -8,8 +8,7 @@ #include "extensions/resource_monitors/fixed_heap/config.h" #include "test/mocks/event/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/resource_monitors/fixed_heap/fixed_heap_monitor_test.cc b/test/extensions/resource_monitors/fixed_heap/fixed_heap_monitor_test.cc index 637d5fe2a9433..699d119bc75b7 100644 --- a/test/extensions/resource_monitors/fixed_heap/fixed_heap_monitor_test.cc +++ b/test/extensions/resource_monitors/fixed_heap/fixed_heap_monitor_test.cc @@ -1,8 +1,9 @@ #include "extensions/resource_monitors/fixed_heap/fixed_heap_monitor.h" +#include "test/test_common/test_base.h" + #include "absl/types/optional.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/resource_monitors/injected_resource/config_test.cc b/test/extensions/resource_monitors/injected_resource/config_test.cc index 371ad3b115149..59f9cbfb37138 100644 --- a/test/extensions/resource_monitors/injected_resource/config_test.cc +++ b/test/extensions/resource_monitors/injected_resource/config_test.cc @@ -9,11 +9,10 @@ #include "extensions/resource_monitors/injected_resource/config.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace ResourceMonitors { diff --git a/test/extensions/resource_monitors/injected_resource/injected_resource_monitor_test.cc b/test/extensions/resource_monitors/injected_resource/injected_resource_monitor_test.cc index c0fa0dd7c8ae2..5b2c5d862d988 100644 --- a/test/extensions/resource_monitors/injected_resource/injected_resource_monitor_test.cc +++ b/test/extensions/resource_monitors/injected_resource/injected_resource_monitor_test.cc @@ -6,13 +6,13 @@ #include "extensions/resource_monitors/injected_resource/injected_resource_monitor.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { @@ -43,7 +43,7 @@ class MockedCallbacks : public Server::ResourceMonitor::Callbacks { MOCK_METHOD1(onFailure, void(const EnvoyException&)); }; -class InjectedResourceMonitorTest : public testing::Test { +class InjectedResourceMonitorTest : public TestBase { protected: InjectedResourceMonitorTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(test_time_.timeSystem(), *api_), diff --git a/test/extensions/retry/host/previous_hosts/config_test.cc b/test/extensions/retry/host/previous_hosts/config_test.cc index aed15a272c441..02621aabba0e9 100644 --- a/test/extensions/retry/host/previous_hosts/config_test.cc +++ b/test/extensions/retry/host/previous_hosts/config_test.cc @@ -5,9 +5,9 @@ #include "extensions/retry/host/well_known_names.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using namespace testing; diff --git a/test/extensions/retry/priority/previous_priorities/config_test.cc b/test/extensions/retry/priority/previous_priorities/config_test.cc index 9d4f0bfe09041..76933ba71092a 100644 --- a/test/extensions/retry/priority/previous_priorities/config_test.cc +++ b/test/extensions/retry/priority/previous_priorities/config_test.cc @@ -6,9 +6,9 @@ #include "extensions/retry/priority/well_known_names.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using namespace testing; @@ -17,7 +17,7 @@ namespace Extensions { namespace Retry { namespace Priority { -class RetryPriorityTest : public ::testing::Test { +class RetryPriorityTest : public TestBase { public: void initialize(const Upstream::HealthyLoad& original_healthy_priority_load, const Upstream::DegradedLoad& original_degraded_priority_load) { diff --git a/test/extensions/stats_sinks/common/statsd/statsd_test.cc b/test/extensions/stats_sinks/common/statsd/statsd_test.cc index 28e8cf180893c..4aa7c7f597c00 100644 --- a/test/extensions/stats_sinks/common/statsd/statsd_test.cc +++ b/test/extensions/stats_sinks/common/statsd/statsd_test.cc @@ -13,9 +13,9 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -29,7 +29,7 @@ namespace StatSinks { namespace Common { namespace Statsd { -class TcpStatsdSinkTest : public testing::Test { +class TcpStatsdSinkTest : public TestBase { public: TcpStatsdSinkTest() { sink_ = std::make_unique( diff --git a/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc b/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc index 85454d3fd6615..dbf8bac660b2a 100644 --- a/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc +++ b/test/extensions/stats_sinks/common/statsd/udp_statsd_test.cc @@ -9,10 +9,10 @@ #include "test/mocks/thread_local/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "spdlog/spdlog.h" using testing::NiceMock; @@ -28,7 +28,7 @@ class MockWriter : public Writer { MOCK_METHOD1(write, void(const std::string& message)); }; -class UdpStatsdSinkTest : public testing::TestWithParam {}; +class UdpStatsdSinkTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, UdpStatsdSinkTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); @@ -72,7 +72,7 @@ TEST_P(UdpStatsdSinkTest, InitWithIpAddress) { tls_.shutdownThread(); } -class UdpStatsdSinkWithTagsTest : public testing::TestWithParam {}; +class UdpStatsdSinkWithTagsTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, UdpStatsdSinkWithTagsTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); diff --git a/test/extensions/stats_sinks/dog_statsd/config_test.cc b/test/extensions/stats_sinks/dog_statsd/config_test.cc index a7d00a70f4d30..f73630a470bdf 100644 --- a/test/extensions/stats_sinks/dog_statsd/config_test.cc +++ b/test/extensions/stats_sinks/dog_statsd/config_test.cc @@ -11,10 +11,10 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -26,7 +26,7 @@ namespace Extensions { namespace StatSinks { namespace DogStatsd { -class DogStatsdConfigLoopbackTest : public testing::TestWithParam {}; +class DogStatsdConfigLoopbackTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, DogStatsdConfigLoopbackTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); diff --git a/test/extensions/stats_sinks/hystrix/config_test.cc b/test/extensions/stats_sinks/hystrix/config_test.cc index abcdcca16910f..f1a0557f610d5 100644 --- a/test/extensions/stats_sinks/hystrix/config_test.cc +++ b/test/extensions/stats_sinks/hystrix/config_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/stats_sinks/hystrix/hystrix_test.cc b/test/extensions/stats_sinks/hystrix/hystrix_test.cc index baf24727a0b31..1e20bc4effb0b 100644 --- a/test/extensions/stats_sinks/hystrix/hystrix_test.cc +++ b/test/extensions/stats_sinks/hystrix/hystrix_test.cc @@ -8,12 +8,12 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "absl/strings/str_split.h" #include "circllhist.h" #include "fmt/printf.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::HasSubstr; @@ -116,7 +116,7 @@ class HistogramWrapper { histogram_t* histogram_; }; -class HystrixSinkTest : public testing::Test { +class HystrixSinkTest : public TestBase { public: HystrixSinkTest() { sink_ = std::make_unique(server_, window_size_); } diff --git a/test/extensions/stats_sinks/metrics_service/grpc_metrics_service_impl_test.cc b/test/extensions/stats_sinks/metrics_service/grpc_metrics_service_impl_test.cc index 932a5ee8adb38..6b9d66f195694 100644 --- a/test/extensions/stats_sinks/metrics_service/grpc_metrics_service_impl_test.cc +++ b/test/extensions/stats_sinks/metrics_service/grpc_metrics_service_impl_test.cc @@ -19,7 +19,7 @@ namespace Extensions { namespace StatSinks { namespace MetricsService { -class GrpcMetricsStreamerImplTest : public testing::Test { +class GrpcMetricsStreamerImplTest : public TestBase { public: typedef Grpc::MockAsyncStream MockMetricsStream; typedef Grpc::TypedAsyncStreamCallbacks @@ -95,7 +95,7 @@ class TestGrpcMetricsStreamer : public GrpcMetricsStreamer { } }; -class MetricsServiceSinkTest : public testing::Test {}; +class MetricsServiceSinkTest : public TestBase {}; TEST(MetricsServiceSinkTest, CheckSendCall) { NiceMock source; diff --git a/test/extensions/stats_sinks/metrics_service/metrics_service_integration_test.cc b/test/extensions/stats_sinks/metrics_service/metrics_service_integration_test.cc index 696bdceb3e970..476dce27a5d49 100644 --- a/test/extensions/stats_sinks/metrics_service/metrics_service_integration_test.cc +++ b/test/extensions/stats_sinks/metrics_service/metrics_service_integration_test.cc @@ -8,10 +8,9 @@ #include "test/common/grpc/grpc_client_integration.h" #include "test/integration/http_integration.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::AssertionResult; namespace Envoy { diff --git a/test/extensions/stats_sinks/statsd/config_test.cc b/test/extensions/stats_sinks/statsd/config_test.cc index 17bc912432c3e..66c249445c618 100644 --- a/test/extensions/stats_sinks/statsd/config_test.cc +++ b/test/extensions/stats_sinks/statsd/config_test.cc @@ -12,10 +12,10 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; @@ -46,7 +46,7 @@ TEST(StatsConfigTest, ValidTcpStatsd) { EXPECT_NE(dynamic_cast(sink.get()), nullptr); } -class StatsConfigParameterizedTest : public testing::TestWithParam {}; +class StatsConfigParameterizedTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, StatsConfigParameterizedTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), @@ -163,7 +163,7 @@ TEST(StatsConfigTest, TcpSinkCustomPrefix) { EXPECT_EQ(tcp_sink->getPrefix(), prefix); } -class StatsConfigLoopbackTest : public testing::TestWithParam {}; +class StatsConfigLoopbackTest : public TestBaseWithParam {}; INSTANTIATE_TEST_SUITE_P(IpVersions, StatsConfigLoopbackTest, testing::ValuesIn(TestEnvironment::getIpVersionsForTest()), TestUtility::ipTestParamsToString); diff --git a/test/extensions/tracers/common/ot/opentracing_driver_impl_test.cc b/test/extensions/tracers/common/ot/opentracing_driver_impl_test.cc index c826495f54bce..fb9aa7c1228aa 100644 --- a/test/extensions/tracers/common/ot/opentracing_driver_impl_test.cc +++ b/test/extensions/tracers/common/ot/opentracing_driver_impl_test.cc @@ -5,9 +5,9 @@ #include "test/mocks/http/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/mocks/tracing/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "opentracing/mocktracer/in_memory_recorder.h" #include "opentracing/mocktracer/tracer.h" @@ -44,7 +44,7 @@ class TestDriver : public OpenTracingDriver { std::shared_ptr tracer_; }; -class OpenTracingDriverTest : public testing::Test { +class OpenTracingDriverTest : public TestBase { public: void setupValidDriver(OpenTracingDriver::PropagationMode propagation_mode = diff --git a/test/extensions/tracers/datadog/config_test.cc b/test/extensions/tracers/datadog/config_test.cc index a4f9b1947000b..49659cda9c188 100644 --- a/test/extensions/tracers/datadog/config_test.cc +++ b/test/extensions/tracers/datadog/config_test.cc @@ -1,9 +1,9 @@ #include "extensions/tracers/datadog/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/tracers/datadog/datadog_tracer_impl_test.cc b/test/extensions/tracers/datadog/datadog_tracer_impl_test.cc index f9cd337dc5ffc..951b4ec673f9f 100644 --- a/test/extensions/tracers/datadog/datadog_tracer_impl_test.cc +++ b/test/extensions/tracers/datadog/datadog_tracer_impl_test.cc @@ -21,10 +21,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtLeast; @@ -38,7 +38,7 @@ namespace Extensions { namespace Tracers { namespace Datadog { -class DatadogDriverTest : public testing::Test { +class DatadogDriverTest : public TestBase { public: void setup(envoy::config::trace::v2::DatadogConfig& datadog_config, bool init_timer) { ON_CALL(cm_, httpAsyncClientForCluster("fake_cluster")) diff --git a/test/extensions/tracers/dynamic_ot/config_test.cc b/test/extensions/tracers/dynamic_ot/config_test.cc index abe86ef705795..074efca2258e1 100644 --- a/test/extensions/tracers/dynamic_ot/config_test.cc +++ b/test/extensions/tracers/dynamic_ot/config_test.cc @@ -2,10 +2,10 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "fmt/printf.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/tracers/dynamic_ot/dynamic_opentracing_driver_impl_test.cc b/test/extensions/tracers/dynamic_ot/dynamic_opentracing_driver_impl_test.cc index 3e75240289bc4..a4789b82b76fa 100644 --- a/test/extensions/tracers/dynamic_ot/dynamic_opentracing_driver_impl_test.cc +++ b/test/extensions/tracers/dynamic_ot/dynamic_opentracing_driver_impl_test.cc @@ -8,17 +8,17 @@ #include "test/mocks/stats/mocks.h" #include "test/mocks/tracing/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "fmt/printf.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { namespace Tracers { namespace DynamicOt { -class DynamicOpenTracingDriverTest : public testing::Test { +class DynamicOpenTracingDriverTest : public TestBase { public: void setup(const std::string& library, const std::string& tracer_config) { driver_ = std::make_unique(stats_, library, tracer_config); diff --git a/test/extensions/tracers/lightstep/config_test.cc b/test/extensions/tracers/lightstep/config_test.cc index 173d3b1c1bc62..ec0f129d4efc2 100644 --- a/test/extensions/tracers/lightstep/config_test.cc +++ b/test/extensions/tracers/lightstep/config_test.cc @@ -1,9 +1,9 @@ #include "extensions/tracers/lightstep/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/extensions/tracers/lightstep/lightstep_tracer_impl_test.cc b/test/extensions/tracers/lightstep/lightstep_tracer_impl_test.cc index 5bbd6c6c2e02f..ac34b3bb8abd3 100644 --- a/test/extensions/tracers/lightstep/lightstep_tracer_impl_test.cc +++ b/test/extensions/tracers/lightstep/lightstep_tracer_impl_test.cc @@ -22,10 +22,10 @@ #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AtLeast; @@ -39,7 +39,7 @@ namespace Extensions { namespace Tracers { namespace Lightstep { -class LightStepDriverTest : public testing::Test { +class LightStepDriverTest : public TestBase { public: void setup(envoy::config::trace::v2::LightstepConfig& lightstep_config, bool init_timer, Common::Ot::OpenTracingDriver::PropagationMode propagation_mode = diff --git a/test/extensions/tracers/zipkin/config_test.cc b/test/extensions/tracers/zipkin/config_test.cc index 017c7344f6b9e..f9ced3f656112 100644 --- a/test/extensions/tracers/zipkin/config_test.cc +++ b/test/extensions/tracers/zipkin/config_test.cc @@ -3,9 +3,9 @@ #include "extensions/tracers/zipkin/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { diff --git a/test/extensions/tracers/zipkin/span_buffer_test.cc b/test/extensions/tracers/zipkin/span_buffer_test.cc index 987e059efdbb6..4e31f1574592d 100644 --- a/test/extensions/tracers/zipkin/span_buffer_test.cc +++ b/test/extensions/tracers/zipkin/span_buffer_test.cc @@ -1,9 +1,8 @@ #include "extensions/tracers/zipkin/span_buffer.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace Tracers { diff --git a/test/extensions/tracers/zipkin/span_context_extractor_test.cc b/test/extensions/tracers/zipkin/span_context_extractor_test.cc index a88815b173c51..19f47d6ad4cf7 100644 --- a/test/extensions/tracers/zipkin/span_context_extractor_test.cc +++ b/test/extensions/tracers/zipkin/span_context_extractor_test.cc @@ -3,10 +3,9 @@ #include "extensions/tracers/zipkin/span_context.h" #include "extensions/tracers/zipkin/span_context_extractor.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace Tracers { diff --git a/test/extensions/tracers/zipkin/tracer_test.cc b/test/extensions/tracers/zipkin/tracer_test.cc index d564ea71a3d80..5f8683f02b8b5 100644 --- a/test/extensions/tracers/zipkin/tracer_test.cc +++ b/test/extensions/tracers/zipkin/tracer_test.cc @@ -11,10 +11,10 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/tracing/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::Return; @@ -36,7 +36,7 @@ class TestReporterImpl : public Reporter { std::vector reported_spans_; }; -class ZipkinTracerTest : public testing::Test { +class ZipkinTracerTest : public TestBase { protected: Event::SimulatedTimeSystem time_system_; }; diff --git a/test/extensions/tracers/zipkin/util_test.cc b/test/extensions/tracers/zipkin/util_test.cc index 3383409837e3e..da23564fcdf15 100644 --- a/test/extensions/tracers/zipkin/util_test.cc +++ b/test/extensions/tracers/zipkin/util_test.cc @@ -1,9 +1,8 @@ #include "extensions/tracers/zipkin/util.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace Tracers { diff --git a/test/extensions/tracers/zipkin/zipkin_core_types_test.cc b/test/extensions/tracers/zipkin/zipkin_core_types_test.cc index a534e6b6e9c04..8ee41672f36e2 100644 --- a/test/extensions/tracers/zipkin/zipkin_core_types_test.cc +++ b/test/extensions/tracers/zipkin/zipkin_core_types_test.cc @@ -5,10 +5,9 @@ #include "extensions/tracers/zipkin/zipkin_core_constants.h" #include "extensions/tracers/zipkin/zipkin_core_types.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Extensions { namespace Tracers { diff --git a/test/extensions/tracers/zipkin/zipkin_tracer_impl_test.cc b/test/extensions/tracers/zipkin/zipkin_tracer_impl_test.cc index 28fb6d2087652..5b65d2650ff1c 100644 --- a/test/extensions/tracers/zipkin/zipkin_tracer_impl_test.cc +++ b/test/extensions/tracers/zipkin/zipkin_tracer_impl_test.cc @@ -21,10 +21,10 @@ #include "test/mocks/thread_local/mocks.h" #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -37,7 +37,7 @@ namespace Extensions { namespace Tracers { namespace Zipkin { -class ZipkinDriverTest : public testing::Test { +class ZipkinDriverTest : public TestBase { public: ZipkinDriverTest() : time_source_(test_time_.timeSystem()) {} diff --git a/test/extensions/transport_sockets/alts/alts_integration_test.cc b/test/extensions/transport_sockets/alts/alts_integration_test.cc index 39a2884e6d736..c4edaaac6d92c 100644 --- a/test/extensions/transport_sockets/alts/alts_integration_test.cc +++ b/test/extensions/transport_sockets/alts/alts_integration_test.cc @@ -11,6 +11,7 @@ #include "test/integration/utility.h" #include "test/mocks/server/mocks.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" @@ -18,7 +19,6 @@ #include "gmock/gmock.h" #include "grpcpp/grpcpp.h" #include "grpcpp/impl/codegen/service_type.h" -#include "gtest/gtest.h" namespace Envoy { namespace Extensions { @@ -26,7 +26,7 @@ namespace TransportSockets { namespace Alts { class AltsIntegrationTestBase : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: AltsIntegrationTestBase(const std::string& server_peer_identity, const std::string& client_peer_identity, bool server_connect_handshaker, diff --git a/test/extensions/transport_sockets/alts/config_test.cc b/test/extensions/transport_sockets/alts/config_test.cc index ec73769e2547b..01b5a4bd4962b 100644 --- a/test/extensions/transport_sockets/alts/config_test.cc +++ b/test/extensions/transport_sockets/alts/config_test.cc @@ -5,9 +5,9 @@ #include "extensions/transport_sockets/alts/config.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using Envoy::Server::Configuration::MockTransportSocketFactoryContext; using testing::_; diff --git a/test/extensions/transport_sockets/alts/noop_transport_socket_callbacks_test.cc b/test/extensions/transport_sockets/alts/noop_transport_socket_callbacks_test.cc index e9a3b6bdfb3c5..7bcd43dee9104 100644 --- a/test/extensions/transport_sockets/alts/noop_transport_socket_callbacks_test.cc +++ b/test/extensions/transport_sockets/alts/noop_transport_socket_callbacks_test.cc @@ -5,8 +5,7 @@ #include "extensions/transport_sockets/alts/noop_transport_socket_callbacks.h" #include "test/mocks/network/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Extensions { @@ -37,7 +36,7 @@ class TestTransportSocketCallbacks : public Network::TransportSocketCallbacks { Network::Connection& connection_; }; -class NoOpTransportSocketCallbacksTest : public testing::Test { +class NoOpTransportSocketCallbacksTest : public TestBase { protected: NoOpTransportSocketCallbacksTest() : wrapper_callbacks_(connection_), wrapped_callbacks_(wrapper_callbacks_) {} diff --git a/test/extensions/transport_sockets/alts/tsi_frame_protector_test.cc b/test/extensions/transport_sockets/alts/tsi_frame_protector_test.cc index 724638b3d4a10..a82d33a11afd2 100644 --- a/test/extensions/transport_sockets/alts/tsi_frame_protector_test.cc +++ b/test/extensions/transport_sockets/alts/tsi_frame_protector_test.cc @@ -2,8 +2,9 @@ #include "extensions/transport_sockets/alts/tsi_frame_protector.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "src/core/tsi/fake_transport_security.h" namespace Envoy { @@ -22,7 +23,7 @@ using namespace std::string_literals; * Test with fake frame protector. The protected frame header is 4 byte length (little endian, * include header itself) and following the body. */ -class TsiFrameProtectorTest : public testing::Test { +class TsiFrameProtectorTest : public TestBase { public: TsiFrameProtectorTest() : raw_frame_protector_(tsi_create_fake_frame_protector(nullptr)), diff --git a/test/extensions/transport_sockets/alts/tsi_handshaker_test.cc b/test/extensions/transport_sockets/alts/tsi_handshaker_test.cc index 75ff19c0f32ed..a07ce881bed19 100644 --- a/test/extensions/transport_sockets/alts/tsi_handshaker_test.cc +++ b/test/extensions/transport_sockets/alts/tsi_handshaker_test.cc @@ -1,9 +1,9 @@ #include "extensions/transport_sockets/alts/tsi_handshaker.h" #include "test/mocks/event/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "src/core/tsi/fake_transport_security.h" namespace Envoy { @@ -32,7 +32,7 @@ class MockTsiHandshakerCallbacks : public TsiHandshakerCallbacks { } }; -class TsiHandshakerTest : public testing::Test { +class TsiHandshakerTest : public TestBase { public: TsiHandshakerTest() : server_handshaker_({tsi_create_fake_handshaker(0)}, dispatcher_), diff --git a/test/extensions/transport_sockets/alts/tsi_socket_test.cc b/test/extensions/transport_sockets/alts/tsi_socket_test.cc index f3e42b231f952..032207fd8a127 100644 --- a/test/extensions/transport_sockets/alts/tsi_socket_test.cc +++ b/test/extensions/transport_sockets/alts/tsi_socket_test.cc @@ -3,9 +3,9 @@ #include "extensions/transport_sockets/alts/tsi_socket.h" #include "test/mocks/network/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "src/core/tsi/fake_transport_security.h" namespace Envoy { @@ -18,7 +18,7 @@ using testing::Return; using testing::ReturnRef; using testing::StrictMock; -class TsiSocketTest : public testing::Test { +class TsiSocketTest : public TestBase { protected: TsiSocketTest() { server_.handshaker_factory_ = [](Event::Dispatcher& dispatcher, @@ -382,7 +382,7 @@ TEST_F(TsiSocketTest, HandshakeWithInternalError) { raw_handshaker->vtable = vtable; } -class TsiSocketFactoryTest : public testing::Test { +class TsiSocketFactoryTest : public TestBase { protected: void SetUp() override { auto handshaker_factory = [](Event::Dispatcher& dispatcher, diff --git a/test/extensions/transport_sockets/tls/context_impl_test.cc b/test/extensions/transport_sockets/tls/context_impl_test.cc index 274f4d0a9add1..bfa059bb2a290 100644 --- a/test/extensions/transport_sockets/tls/context_impl_test.cc +++ b/test/extensions/transport_sockets/tls/context_impl_test.cc @@ -19,9 +19,9 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" #include "openssl/x509v3.h" using Envoy::Protobuf::util::MessageDifferencer; diff --git a/test/extensions/transport_sockets/tls/ssl_certs_test.h b/test/extensions/transport_sockets/tls/ssl_certs_test.h index 94b6dc206c394..339716fe92237 100644 --- a/test/extensions/transport_sockets/tls/ssl_certs_test.h +++ b/test/extensions/transport_sockets/tls/ssl_certs_test.h @@ -2,13 +2,12 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::ReturnRef; namespace Envoy { -class SslCertsTest : public testing::Test { +class SslCertsTest : public TestBase { public: static void SetUpTestSuite() { TestEnvironment::exec({TestEnvironment::runfilesPath( diff --git a/test/extensions/transport_sockets/tls/ssl_socket_test.cc b/test/extensions/transport_sockets/tls/ssl_socket_test.cc index 0e1d6152df0d8..10d4d6e064d44 100644 --- a/test/extensions/transport_sockets/tls/ssl_socket_test.cc +++ b/test/extensions/transport_sockets/tls/ssl_socket_test.cc @@ -33,11 +33,11 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/str_replace.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "openssl/ssl.h" using testing::_; diff --git a/test/extensions/transport_sockets/tls/ssl_test_utility.h b/test/extensions/transport_sockets/tls/ssl_test_utility.h index 7fa071c800bf2..7d41cbbdcd690 100644 --- a/test/extensions/transport_sockets/tls/ssl_test_utility.h +++ b/test/extensions/transport_sockets/tls/ssl_test_utility.h @@ -4,8 +4,8 @@ #include #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" -#include "gtest/gtest.h" #include "openssl/ssl.h" #include "openssl/x509v3.h" diff --git a/test/extensions/transport_sockets/tls/utility_test.cc b/test/extensions/transport_sockets/tls/utility_test.cc index 494170a21ba00..385ad365f2b65 100644 --- a/test/extensions/transport_sockets/tls/utility_test.cc +++ b/test/extensions/transport_sockets/tls/utility_test.cc @@ -7,10 +7,10 @@ #include "test/extensions/transport_sockets/tls/test_data/san_dns_cert_info.h" #include "test/test_common/environment.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/time/time.h" -#include "gtest/gtest.h" #include "openssl/x509v3.h" namespace Envoy { diff --git a/test/fuzz/main.cc b/test/fuzz/main.cc index 61d53dd7b22e0..023a5078cc1ca 100644 --- a/test/fuzz/main.cc +++ b/test/fuzz/main.cc @@ -18,17 +18,16 @@ #include "test/fuzz/fuzz_runner.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace { // List of paths for files in the test corpus. std::vector test_corpus_; -class FuzzerCorpusTest : public ::testing::TestWithParam { +class FuzzerCorpusTest : public TestBaseWithParam { protected: FuzzerCorpusTest() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/integration/ads_integration_test.cc b/test/integration/ads_integration_test.cc index 9455793f8eb0d..e2f7294b9ee3a 100644 --- a/test/integration/ads_integration_test.cc +++ b/test/integration/ads_integration_test.cc @@ -20,10 +20,9 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/network_utility.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::AssertionFailure; using testing::AssertionResult; using testing::AssertionSuccess; diff --git a/test/integration/cds_integration_test.cc b/test/integration/cds_integration_test.cc index 455d58a46ddfa..9958c2d58c9c3 100644 --- a/test/integration/cds_integration_test.cc +++ b/test/integration/cds_integration_test.cc @@ -14,10 +14,10 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/network_utility.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/synchronization/notification.h" -#include "gtest/gtest.h" using testing::AssertionFailure; using testing::AssertionResult; diff --git a/test/integration/echo_integration_test.cc b/test/integration/echo_integration_test.cc index 55dae2942a08e..da64a31270779 100644 --- a/test/integration/echo_integration_test.cc +++ b/test/integration/echo_integration_test.cc @@ -8,7 +8,7 @@ namespace Envoy { std::string echo_config; class EchoIntegrationTest : public BaseIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: EchoIntegrationTest() : BaseIntegrationTest(GetParam(), realTime(), echo_config) {} diff --git a/test/integration/eds_integration_test.cc b/test/integration/eds_integration_test.cc index ebfacb27906d1..7412163d7661e 100644 --- a/test/integration/eds_integration_test.cc +++ b/test/integration/eds_integration_test.cc @@ -5,8 +5,7 @@ #include "test/config/utility.h" #include "test/integration/http_integration.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace { @@ -14,7 +13,7 @@ namespace { // Integration test for EDS features. EDS is consumed via filesystem // subscription. class EdsIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: EdsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/integration/hds_integration_test.cc b/test/integration/hds_integration_test.cc index 702d731ae6d89..16efcd8400d74 100644 --- a/test/integration/hds_integration_test.cc +++ b/test/integration/hds_integration_test.cc @@ -16,15 +16,15 @@ #include "test/config/utility.h" #include "test/integration/http_integration.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace { class HdsIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: HdsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/integration/header_integration_test.cc b/test/integration/header_integration_test.cc index bc665df7c72aa..40c0672504c8a 100644 --- a/test/integration/header_integration_test.cc +++ b/test/integration/header_integration_test.cc @@ -8,19 +8,18 @@ #include "test/integration/http_integration.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace { std::string ipSuppressEnvoyHeadersTestParamsToString( - const testing::TestParamInfo>& params) { + const ::testing::TestParamInfo>& params) { return fmt::format( "{}_{}", TestUtility::ipTestParamsToString( - testing::TestParamInfo(std::get<0>(params.param), 0)), + ::testing::TestParamInfo(std::get<0>(params.param), 0)), std::get<1>(params.param) ? "with_x_envoy_from_router" : "without_x_envoy_from_router"); } @@ -151,7 +150,7 @@ stat_prefix: header_test class HeaderIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam> { + public TestBaseWithParam> { public: HeaderIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, std::get<0>(GetParam()), realTime()) {} diff --git a/test/integration/http2_integration_test.cc b/test/integration/http2_integration_test.cc index 3665698d89da6..cdcd637b5550c 100644 --- a/test/integration/http2_integration_test.cc +++ b/test/integration/http2_integration_test.cc @@ -9,10 +9,9 @@ #include "test/mocks/http/mocks.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using ::testing::HasSubstr; using ::testing::MatchesRegex; diff --git a/test/integration/http2_integration_test.h b/test/integration/http2_integration_test.h index 9319cc27fd98c..c63d60ba0dfe9 100644 --- a/test/integration/http2_integration_test.h +++ b/test/integration/http2_integration_test.h @@ -1,12 +1,11 @@ #pragma once #include "test/integration/http_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { class Http2IntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: Http2IntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam(), realTime()) {} diff --git a/test/integration/http2_upstream_integration_test.cc b/test/integration/http2_upstream_integration_test.cc index 0e0ba792cb485..155dd9f0386a2 100644 --- a/test/integration/http2_upstream_integration_test.cc +++ b/test/integration/http2_upstream_integration_test.cc @@ -6,10 +6,9 @@ #include "test/integration/autonomous_upstream.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { INSTANTIATE_TEST_SUITE_P(IpVersions, Http2UpstreamIntegrationTest, diff --git a/test/integration/http2_upstream_integration_test.h b/test/integration/http2_upstream_integration_test.h index 4a7779580bc26..0bcb228acbd79 100644 --- a/test/integration/http2_upstream_integration_test.h +++ b/test/integration/http2_upstream_integration_test.h @@ -1,12 +1,11 @@ #pragma once #include "test/integration/http_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { class Http2UpstreamIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: Http2UpstreamIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam(), realTime()) {} diff --git a/test/integration/http_integration.cc b/test/integration/http_integration.cc index 0cee15a594947..2815e2e59d212 100644 --- a/test/integration/http_integration.cc +++ b/test/integration/http_integration.cc @@ -30,8 +30,7 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" #include "test/test_common/registry.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::_; using testing::AnyNumber; diff --git a/test/integration/http_protocol_integration.h b/test/integration/http_protocol_integration.h index 4f587c7e839b5..36d47b7a038e7 100644 --- a/test/integration/http_protocol_integration.h +++ b/test/integration/http_protocol_integration.h @@ -1,8 +1,7 @@ #pragma once #include "test/integration/http_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { @@ -27,7 +26,7 @@ struct HttpProtocolTestParams { // .... // } class HttpProtocolIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: // By default returns 8 combinations of // [HTTP upstream / HTTP downstream] x [Ipv4, IPv6] @@ -46,7 +45,7 @@ class HttpProtocolIntegrationTest : public HttpIntegrationTest, // Allows pretty printed test names of the form // FooTestCase.BarInstance/IPv4_Http2Downstream_HttpUpstream static std::string - protocolTestParamsToString(const testing::TestParamInfo& p); + protocolTestParamsToString(const ::testing::TestParamInfo& p); HttpProtocolIntegrationTest() : HttpIntegrationTest(GetParam().downstream_protocol, GetParam().version, realTime()) {} diff --git a/test/integration/integration.cc b/test/integration/integration.cc index 84859fd73a45e..ac57ca81079dc 100644 --- a/test/integration/integration.cc +++ b/test/integration/integration.cc @@ -30,8 +30,7 @@ #include "test/integration/utility.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::_; using testing::AnyNumber; diff --git a/test/integration/integration_admin_test.cc b/test/integration/integration_admin_test.cc index 3e940e82a7c68..0dcdf795a00c1 100644 --- a/test/integration/integration_admin_test.cc +++ b/test/integration/integration_admin_test.cc @@ -9,9 +9,9 @@ #include "common/stats/stats_matcher_impl.h" #include "test/integration/utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" #include "spdlog/spdlog.h" namespace Envoy { @@ -416,7 +416,7 @@ TEST_P(IntegrationAdminTest, AdminCpuProfilerStart) { EXPECT_STREQ("200", response->headers().Status()->value().c_str()); } -class IntegrationAdminIpv4Ipv6Test : public HttpIntegrationTest, public testing::Test { +class IntegrationAdminIpv4Ipv6Test : public HttpIntegrationTest, public TestBase { public: IntegrationAdminIpv4Ipv6Test() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, Network::Address::IpVersion::v4, @@ -451,7 +451,7 @@ TEST_F(IntegrationAdminIpv4Ipv6Test, Ipv4Ipv6Listen) { // restrictions on their names. class StatsMatcherIntegrationTest : public HttpIntegrationTest, - public testing::Test, + public TestBase, public testing::WithParamInterface { public: StatsMatcherIntegrationTest() diff --git a/test/integration/integration_admin_test.h b/test/integration/integration_admin_test.h index 0bc34fbe72d46..d8d21a9ce1299 100644 --- a/test/integration/integration_admin_test.h +++ b/test/integration/integration_admin_test.h @@ -3,8 +3,7 @@ #include "common/json/json_loader.h" #include "test/integration/http_protocol_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/integration/integration_test.cc b/test/integration/integration_test.cc index b1c2c984fc47a..6efef370306f1 100644 --- a/test/integration/integration_test.cc +++ b/test/integration/integration_test.cc @@ -12,10 +12,9 @@ #include "test/mocks/http/mocks.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using Envoy::Http::Headers; using Envoy::Http::HeaderValueOf; using Envoy::Http::HttpStatusIs; diff --git a/test/integration/integration_test.h b/test/integration/integration_test.h index 96f17288e1712..13352ca960e79 100644 --- a/test/integration/integration_test.h +++ b/test/integration/integration_test.h @@ -1,12 +1,11 @@ #pragma once #include "test/integration/http_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { class IntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: IntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} }; diff --git a/test/integration/load_stats_integration_test.cc b/test/integration/load_stats_integration_test.cc index fe0bcceeab9ef..aeef4cc7ee8a1 100644 --- a/test/integration/load_stats_integration_test.cc +++ b/test/integration/load_stats_integration_test.cc @@ -8,15 +8,14 @@ #include "test/config/utility.h" #include "test/integration/http_integration.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace { class LoadStatsIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: LoadStatsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) { diff --git a/test/integration/proxy_proto_integration_test.cc b/test/integration/proxy_proto_integration_test.cc index 691abd149b13b..d5fe3a79e6c7a 100644 --- a/test/integration/proxy_proto_integration_test.cc +++ b/test/integration/proxy_proto_integration_test.cc @@ -4,10 +4,10 @@ #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "fmt/format.h" -#include "gtest/gtest.h" namespace Envoy { diff --git a/test/integration/proxy_proto_integration_test.h b/test/integration/proxy_proto_integration_test.h index d12badf470ad2..5f663e6b9f51a 100644 --- a/test/integration/proxy_proto_integration_test.h +++ b/test/integration/proxy_proto_integration_test.h @@ -5,12 +5,11 @@ #include "test/integration/fake_upstream.h" #include "test/integration/http_integration.h" #include "test/integration/server.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { class ProxyProtoIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: ProxyProtoIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) { diff --git a/test/integration/ratelimit_integration_test.cc b/test/integration/ratelimit_integration_test.cc index ed855fe5a4021..ae0bc73b5fcac 100644 --- a/test/integration/ratelimit_integration_test.cc +++ b/test/integration/ratelimit_integration_test.cc @@ -8,8 +8,7 @@ #include "test/common/grpc/grpc_client_integration.h" #include "test/integration/http_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace { diff --git a/test/integration/sds_dynamic_integration_test.cc b/test/integration/sds_dynamic_integration_test.cc index 2c2ffe5135e40..e1d026a10defa 100644 --- a/test/integration/sds_dynamic_integration_test.cc +++ b/test/integration/sds_dynamic_integration_test.cc @@ -20,12 +20,12 @@ #include "test/mocks/secret/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time_system.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "integration.h" #include "utility.h" diff --git a/test/integration/sds_static_integration_test.cc b/test/integration/sds_static_integration_test.cc index 462094696737a..9fa494a7992ee 100644 --- a/test/integration/sds_static_integration_test.cc +++ b/test/integration/sds_static_integration_test.cc @@ -18,12 +18,12 @@ #include "test/mocks/secret/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time_system.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "integration.h" #include "utility.h" @@ -33,9 +33,8 @@ using testing::Return; namespace Envoy { namespace Ssl { -class SdsStaticDownstreamIntegrationTest - : public HttpIntegrationTest, - public testing::TestWithParam { +class SdsStaticDownstreamIntegrationTest : public HttpIntegrationTest, + public TestBaseWithParam { public: SdsStaticDownstreamIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} @@ -106,9 +105,8 @@ TEST_P(SdsStaticDownstreamIntegrationTest, RouterRequestAndResponseWithGiantBody testRouterRequestAndResponseWithBody(16 * 1024 * 1024, 16 * 1024 * 1024, false, &creator); } -class SdsStaticUpstreamIntegrationTest - : public HttpIntegrationTest, - public testing::TestWithParam { +class SdsStaticUpstreamIntegrationTest : public HttpIntegrationTest, + public TestBaseWithParam { public: SdsStaticUpstreamIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam(), realTime()) {} diff --git a/test/integration/server.cc b/test/integration/server.cc index 251438fb242d0..4fa5551d9fa0d 100644 --- a/test/integration/server.cc +++ b/test/integration/server.cc @@ -19,9 +19,9 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "absl/strings/str_replace.h" -#include "gtest/gtest.h" namespace Envoy { namespace Server { diff --git a/test/integration/ssl_integration_test.cc b/test/integration/ssl_integration_test.cc index 97083b02b7dab..99d13f7b62a2c 100644 --- a/test/integration/ssl_integration_test.cc +++ b/test/integration/ssl_integration_test.cc @@ -14,11 +14,11 @@ #include "extensions/transport_sockets/tls/context_manager_impl.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "integration.h" #include "utility.h" @@ -176,8 +176,8 @@ TEST_P(SslIntegrationTest, AdminCertEndpoint) { // Validate certificate selection across different certificate types and client TLS versions. class SslCertficateIntegrationTest : public SslIntegrationTestBase, - public testing::TestWithParam> { + public TestBaseWithParam> { public: SslCertficateIntegrationTest() : SslIntegrationTestBase(std::get<0>(GetParam())) { server_tlsv1_3_ = true; @@ -210,7 +210,7 @@ class SslCertficateIntegrationTest } static std::string ipClientVersionTestParamsToString( - const testing::TestParamInfo< + const ::testing::TestParamInfo< std::tuple>& params) { return fmt::format("{}_TLSv1_{}", diff --git a/test/integration/ssl_integration_test.h b/test/integration/ssl_integration_test.h index 4acbb234f747a..f28a9343803b7 100644 --- a/test/integration/ssl_integration_test.h +++ b/test/integration/ssl_integration_test.h @@ -7,9 +7,9 @@ #include "test/integration/server.h" #include "test/integration/ssl_utility.h" #include "test/mocks/secret/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; @@ -44,7 +44,7 @@ class SslIntegrationTestBase : public HttpIntegrationTest { }; class SslIntegrationTest : public SslIntegrationTestBase, - public testing::TestWithParam { + public TestBaseWithParam { public: SslIntegrationTest() : SslIntegrationTestBase(GetParam()) {} void TearDown() override { SslIntegrationTestBase::TearDown(); }; diff --git a/test/integration/ssl_utility.cc b/test/integration/ssl_utility.cc index 59c036109ead2..4254a7c273144 100644 --- a/test/integration/ssl_utility.cc +++ b/test/integration/ssl_utility.cc @@ -12,8 +12,7 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::ReturnRef; diff --git a/test/integration/stats_integration_test.cc b/test/integration/stats_integration_test.cc index a90fa5115d724..4d36b4d8c5a7a 100644 --- a/test/integration/stats_integration_test.cc +++ b/test/integration/stats_integration_test.cc @@ -5,15 +5,14 @@ #include "test/integration/integration.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace { class StatsIntegrationTest : public BaseIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: StatsIntegrationTest() : BaseIntegrationTest(GetParam(), realTime()) {} diff --git a/test/integration/tcp_conn_pool_integration_test.cc b/test/integration/tcp_conn_pool_integration_test.cc index 1335ebc1d5d7b..5ca30b0e8ed7a 100644 --- a/test/integration/tcp_conn_pool_integration_test.cc +++ b/test/integration/tcp_conn_pool_integration_test.cc @@ -112,7 +112,7 @@ class TestFilterConfigFactory : public Server::Configuration::NamedNetworkFilter } // namespace class TcpConnPoolIntegrationTest : public BaseIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: TcpConnPoolIntegrationTest() : BaseIntegrationTest(GetParam(), realTime(), tcp_conn_pool_config), diff --git a/test/integration/tcp_proxy_integration_test.cc b/test/integration/tcp_proxy_integration_test.cc index 2d9862983762e..d2de9a7d12822 100644 --- a/test/integration/tcp_proxy_integration_test.cc +++ b/test/integration/tcp_proxy_integration_test.cc @@ -11,8 +11,7 @@ #include "test/integration/ssl_utility.h" #include "test/integration/utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::_; using testing::Invoke; diff --git a/test/integration/tcp_proxy_integration_test.h b/test/integration/tcp_proxy_integration_test.h index 5e7fb5c29b369..af0156821e87a 100644 --- a/test/integration/tcp_proxy_integration_test.h +++ b/test/integration/tcp_proxy_integration_test.h @@ -5,13 +5,12 @@ #include "test/integration/integration.h" #include "test/mocks/secret/mocks.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace { class TcpProxyIntegrationTest : public BaseIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: TcpProxyIntegrationTest() : BaseIntegrationTest(GetParam(), realTime(), ConfigHelper::TCP_PROXY_CONFIG) { diff --git a/test/integration/uds_integration_test.cc b/test/integration/uds_integration_test.cc index 8c93f738ea05a..f4d70a81e07b0 100644 --- a/test/integration/uds_integration_test.cc +++ b/test/integration/uds_integration_test.cc @@ -4,8 +4,7 @@ #include "common/network/utility.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/integration/uds_integration_test.h b/test/integration/uds_integration_test.h index 85891bd18d98d..7cb73485c2205 100644 --- a/test/integration/uds_integration_test.h +++ b/test/integration/uds_integration_test.h @@ -9,14 +9,13 @@ #include "test/integration/http_integration.h" #include "test/integration/server.h" #include "test/test_common/environment.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { class UdsUpstreamIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam> { + public TestBaseWithParam> { public: UdsUpstreamIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, std::get<0>(GetParam()), realTime()), @@ -47,7 +46,7 @@ class UdsUpstreamIntegrationTest class UdsListenerIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam> { + public TestBaseWithParam> { public: UdsListenerIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, std::get<0>(GetParam()), realTime()), diff --git a/test/integration/websocket_integration_test.cc b/test/integration/websocket_integration_test.cc index 92d1f696403e3..0473e41a65734 100644 --- a/test/integration/websocket_integration_test.cc +++ b/test/integration/websocket_integration_test.cc @@ -10,10 +10,10 @@ #include "test/integration/utility.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/str_cat.h" -#include "gtest/gtest.h" using testing::MatchesRegex; diff --git a/test/integration/websocket_integration_test.h b/test/integration/websocket_integration_test.h index 69f88ccb1f1b2..398d478d9c2d4 100644 --- a/test/integration/websocket_integration_test.h +++ b/test/integration/websocket_integration_test.h @@ -1,8 +1,7 @@ #pragma once #include "test/integration/http_protocol_integration.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { diff --git a/test/integration/xds_integration_test.cc b/test/integration/xds_integration_test.cc index 68bde1631235a..ebe86cb9332c3 100644 --- a/test/integration/xds_integration_test.cc +++ b/test/integration/xds_integration_test.cc @@ -1,14 +1,13 @@ #include "test/integration/http_integration.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace { // This is a minimal litmus test for the v2 xDS APIs. class XdsIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: XdsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP2, GetParam(), realTime()) { diff --git a/test/integration/xfcc_integration_test.cc b/test/integration/xfcc_integration_test.cc index b31660b46e84a..2d98a774389b2 100644 --- a/test/integration/xfcc_integration_test.cc +++ b/test/integration/xfcc_integration_test.cc @@ -17,10 +17,10 @@ #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "integration.h" #include "ssl_integration_test.h" #include "utility.h" diff --git a/test/integration/xfcc_integration_test.h b/test/integration/xfcc_integration_test.h index 055b76132b07c..780e36f6ebbf7 100644 --- a/test/integration/xfcc_integration_test.h +++ b/test/integration/xfcc_integration_test.h @@ -7,11 +7,11 @@ #include "test/integration/http_integration.h" #include "test/integration/server.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "absl/strings/ascii.h" #include "absl/strings/str_replace.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; using testing::ReturnRef; @@ -20,7 +20,7 @@ namespace Envoy { namespace Xfcc { class XfccIntegrationTest : public HttpIntegrationTest, - public testing::TestWithParam { + public TestBaseWithParam { public: const std::string previous_xfcc_ = "By=spiffe://lyft.com/frontend;Hash=123456;URI=spiffe://lyft.com/testclient"; diff --git a/test/mocks/access_log/mocks.cc b/test/mocks/access_log/mocks.cc index 6f7edb0232aa2..d1e10758c3fb3 100644 --- a/test/mocks/access_log/mocks.cc +++ b/test/mocks/access_log/mocks.cc @@ -1,7 +1,8 @@ #include "test/mocks/access_log/mocks.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; diff --git a/test/mocks/api/mocks.cc b/test/mocks/api/mocks.cc index a805a623d7c32..4aab4c9c1759e 100644 --- a/test/mocks/api/mocks.cc +++ b/test/mocks/api/mocks.cc @@ -3,8 +3,9 @@ #include "common/common/assert.h" #include "common/common/lock_guard.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; diff --git a/test/mocks/common.h b/test/mocks/common.h index 5908a0f9a804c..41bf7fe903cdc 100644 --- a/test/mocks/common.h +++ b/test/mocks/common.h @@ -8,6 +8,7 @@ #include "common/common/logger.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "absl/strings/string_view.h" diff --git a/test/mocks/event/mocks.cc b/test/mocks/event/mocks.cc index 59d724f85e4da..13c929af64d55 100644 --- a/test/mocks/event/mocks.cc +++ b/test/mocks/event/mocks.cc @@ -1,7 +1,8 @@ #include "mocks.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/http/mocks.cc b/test/mocks/http/mocks.cc index 2e071d5a11c03..77c29ff6ffe36 100644 --- a/test/mocks/http/mocks.cc +++ b/test/mocks/http/mocks.cc @@ -3,8 +3,9 @@ #include "envoy/buffer/buffer.h" #include "envoy/event/dispatcher.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/init/mocks.cc b/test/mocks/init/mocks.cc index ce0cb291ebcad..6eeac3f5e2c7b 100644 --- a/test/mocks/init/mocks.cc +++ b/test/mocks/init/mocks.cc @@ -2,8 +2,9 @@ #include +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/local_info/mocks.cc b/test/mocks/local_info/mocks.cc index c5addcc3912ca..26329ccf1dad8 100644 --- a/test/mocks/local_info/mocks.cc +++ b/test/mocks/local_info/mocks.cc @@ -2,8 +2,9 @@ #include "common/network/address_impl.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::Invoke; using testing::Return; diff --git a/test/mocks/network/mocks.cc b/test/mocks/network/mocks.cc index 538c5c36cd312..268053547040b 100644 --- a/test/mocks/network/mocks.cc +++ b/test/mocks/network/mocks.cc @@ -10,9 +10,9 @@ #include "common/network/utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/router/mocks.cc b/test/mocks/router/mocks.cc index 17b94a4b97f2e..278a4084a4335 100644 --- a/test/mocks/router/mocks.cc +++ b/test/mocks/router/mocks.cc @@ -2,8 +2,9 @@ #include +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::NiceMock; diff --git a/test/mocks/runtime/mocks.cc b/test/mocks/runtime/mocks.cc index acc39e811d862..c9e9793dcbb4b 100644 --- a/test/mocks/runtime/mocks.cc +++ b/test/mocks/runtime/mocks.cc @@ -1,7 +1,8 @@ #include "mocks.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Return; diff --git a/test/mocks/secret/mocks.h b/test/mocks/secret/mocks.h index 428f1ec28faad..b69fa6897a526 100644 --- a/test/mocks/secret/mocks.h +++ b/test/mocks/secret/mocks.h @@ -5,8 +5,9 @@ #include "envoy/server/transport_socket_config.h" #include "envoy/ssl/tls_certificate_config.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { namespace Secret { diff --git a/test/mocks/server/mocks.cc b/test/mocks/server/mocks.cc index b0523c36fa538..c0ab9e59f422e 100644 --- a/test/mocks/server/mocks.cc +++ b/test/mocks/server/mocks.cc @@ -4,8 +4,9 @@ #include "common/singleton/manager_impl.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/server/mocks.h b/test/mocks/server/mocks.h index 0e8dfde93f5c3..74d48128444ed 100644 --- a/test/mocks/server/mocks.h +++ b/test/mocks/server/mocks.h @@ -39,11 +39,11 @@ #include "test/mocks/thread_local/mocks.h" #include "test/mocks/tracing/mocks.h" #include "test/mocks/upstream/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time_system.h" #include "absl/strings/string_view.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "spdlog/spdlog.h" namespace Envoy { diff --git a/test/mocks/stats/mocks.cc b/test/mocks/stats/mocks.cc index 5b1dbf98df98c..860ccee04e0b6 100644 --- a/test/mocks/stats/mocks.cc +++ b/test/mocks/stats/mocks.cc @@ -1,7 +1,8 @@ #include "mocks.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/stream_info/mocks.cc b/test/mocks/stream_info/mocks.cc index 7a17c006bd2ab..ac27d97443a97 100644 --- a/test/mocks/stream_info/mocks.cc +++ b/test/mocks/stream_info/mocks.cc @@ -2,8 +2,9 @@ #include "common/network/address_impl.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Const; diff --git a/test/mocks/thread_local/mocks.cc b/test/mocks/thread_local/mocks.cc index cfabd7a7f52f0..713855d3ce301 100644 --- a/test/mocks/thread_local/mocks.cc +++ b/test/mocks/thread_local/mocks.cc @@ -1,7 +1,8 @@ #include "mocks.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/tracing/mocks.cc b/test/mocks/tracing/mocks.cc index f35c98b383569..ee157fc212bdd 100644 --- a/test/mocks/tracing/mocks.cc +++ b/test/mocks/tracing/mocks.cc @@ -1,7 +1,8 @@ #include "mocks.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::Return; using testing::ReturnRef; diff --git a/test/mocks/upstream/cluster_info.h b/test/mocks/upstream/cluster_info.h index 0aa4f3627e712..df09688a5bc7c 100644 --- a/test/mocks/upstream/cluster_info.h +++ b/test/mocks/upstream/cluster_info.h @@ -14,9 +14,9 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/stats/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; diff --git a/test/mocks/upstream/mocks.cc b/test/mocks/upstream/mocks.cc index 0e32283276a02..cf84f12047da3 100644 --- a/test/mocks/upstream/mocks.cc +++ b/test/mocks/upstream/mocks.cc @@ -5,8 +5,9 @@ #include "envoy/upstream/load_balancer.h" +#include "test/test_common/test_base.h" + #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; diff --git a/test/mocks/upstream/mocks.h b/test/mocks/upstream/mocks.h index 0800d58f56294..ed0546f1b4820 100644 --- a/test/mocks/upstream/mocks.h +++ b/test/mocks/upstream/mocks.h @@ -25,9 +25,9 @@ #include "test/mocks/tcp/mocks.h" #include "test/mocks/upstream/cluster_info.h" #include "test/mocks/upstream/load_balancer_context.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::NiceMock; diff --git a/test/server/backtrace_test.cc b/test/server/backtrace_test.cc index cfcc2cc2c81e7..894ec568bfc12 100644 --- a/test/server/backtrace_test.cc +++ b/test/server/backtrace_test.cc @@ -1,6 +1,6 @@ #include "server/backtrace.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { TEST(Backward, Basic) { diff --git a/test/server/config_validation/dispatcher_test.cc b/test/server/config_validation/dispatcher_test.cc index d30db3ad8ba3e..7f7342380e721 100644 --- a/test/server/config_validation/dispatcher_test.cc +++ b/test/server/config_validation/dispatcher_test.cc @@ -19,7 +19,7 @@ namespace Envoy { // Define fixture which allocates ValidationDispatcher. -class ConfigValidation : public ::testing::TestWithParam { +class ConfigValidation : public TestBaseWithParam { public: ConfigValidation() { Event::Libevent::Global::initialize(); diff --git a/test/server/config_validation/server_test.cc b/test/server/config_validation/server_test.cc index 2099653510239..0479b9d2cc103 100644 --- a/test/server/config_validation/server_test.cc +++ b/test/server/config_validation/server_test.cc @@ -11,7 +11,7 @@ namespace Envoy { namespace Server { // Test param is the path to the config file to validate. -class ValidationServerTest : public testing::TestWithParam { +class ValidationServerTest : public TestBaseWithParam { public: static void SetupTestDirectory() { TestEnvironment::exec( diff --git a/test/server/configuration_impl_test.cc b/test/server/configuration_impl_test.cc index 032fe30c47096..2b6b6217bee9b 100644 --- a/test/server/configuration_impl_test.cc +++ b/test/server/configuration_impl_test.cc @@ -16,11 +16,11 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "fmt/printf.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::InSequence; using testing::Return; @@ -50,7 +50,7 @@ TEST(FilterChainUtility, buildFilterChainFailWithBadFilters) { EXPECT_EQ(FilterChainUtility::buildFilterChain(connection, factories), false); } -class ConfigurationImplTest : public testing::Test { +class ConfigurationImplTest : public TestBase { protected: ConfigurationImplTest() : api_(Api::createApiForTest(stats_store_)), diff --git a/test/server/connection_handler_test.cc b/test/server/connection_handler_test.cc index c22078eee68b8..4ebe8816cb438 100644 --- a/test/server/connection_handler_test.cc +++ b/test/server/connection_handler_test.cc @@ -10,9 +10,9 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/network_utility.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::ByRef; @@ -25,7 +25,7 @@ using testing::ReturnRef; namespace Envoy { namespace Server { -class ConnectionHandlerTest : public testing::Test, protected Logger::Loggable { +class ConnectionHandlerTest : public TestBase, protected Logger::Loggable { public: ConnectionHandlerTest() : handler_(new ConnectionHandlerImpl(ENVOY_LOGGER(), dispatcher_)), diff --git a/test/server/drain_manager_impl_test.cc b/test/server/drain_manager_impl_test.cc index 29ba7fd659915..b74f26bda3431 100644 --- a/test/server/drain_manager_impl_test.cc +++ b/test/server/drain_manager_impl_test.cc @@ -3,9 +3,9 @@ #include "server/drain_manager_impl.h" #include "test/mocks/server/mocks.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -15,7 +15,7 @@ using testing::SaveArg; namespace Envoy { namespace Server { -class DrainManagerImplTest : public testing::Test { +class DrainManagerImplTest : public TestBase { public: DrainManagerImplTest() { ON_CALL(server_.options_, drainTime()).WillByDefault(Return(std::chrono::seconds(600))); diff --git a/test/server/guarddog_impl_test.cc b/test/server/guarddog_impl_test.cc index 4b27653cc780a..b2bd21eef329b 100644 --- a/test/server/guarddog_impl_test.cc +++ b/test/server/guarddog_impl_test.cc @@ -13,10 +13,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::InSequence; using testing::NiceMock; @@ -24,7 +24,7 @@ using testing::NiceMock; namespace Envoy { namespace Server { -class GuardDogTestBase : public testing::Test { +class GuardDogTestBase : public TestBase { protected: GuardDogTestBase() : api_(Api::createApiForTest(stats_store_)) {} diff --git a/test/server/hot_restart_impl_test.cc b/test/server/hot_restart_impl_test.cc index a22392b56ad56..7bb5ed4e7f4ac 100644 --- a/test/server/hot_restart_impl_test.cc +++ b/test/server/hot_restart_impl_test.cc @@ -8,11 +8,11 @@ #include "test/mocks/api/mocks.h" #include "test/mocks/server/mocks.h" #include "test/test_common/logging.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "absl/strings/match.h" #include "absl/strings/string_view.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -24,7 +24,7 @@ using testing::WithArg; namespace Envoy { namespace Server { -class HotRestartImplTest : public testing::Test { +class HotRestartImplTest : public TestBase { public: void setup() { EXPECT_CALL(os_sys_calls_, shmUnlink(_)); diff --git a/test/server/http/admin_test.cc b/test/server/http/admin_test.cc index e7ca80fbdf6d1..b2596169d6f15 100644 --- a/test/server/http/admin_test.cc +++ b/test/server/http/admin_test.cc @@ -26,11 +26,11 @@ #include "test/test_common/logging.h" #include "test/test_common/network_utility.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "absl/strings/match.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AllOf; @@ -48,7 +48,7 @@ using testing::ReturnRef; namespace Envoy { namespace Server { -class AdminStatsTest : public testing::TestWithParam { +class AdminStatsTest : public TestBaseWithParam { public: AdminStatsTest() : alloc_(options_) { store_ = std::make_unique(options_, alloc_); @@ -71,7 +71,7 @@ class AdminStatsTest : public testing::TestWithParam store_; }; -class AdminFilterTest : public testing::TestWithParam { +class AdminFilterTest : public TestBaseWithParam { public: AdminFilterTest() : admin_(TestEnvironment::temporaryPath("envoy.prof"), server_), @@ -588,7 +588,7 @@ TEST_P(AdminFilterTest, Trailers) { EXPECT_EQ(Http::FilterTrailersStatus::StopIteration, filter_.decodeTrailers(request_headers_)); } -class AdminInstanceTest : public testing::TestWithParam { +class AdminInstanceTest : public TestBaseWithParam { public: AdminInstanceTest() : address_out_path_(TestEnvironment::temporaryPath("admin.address")), @@ -1219,7 +1219,7 @@ class HistogramWrapper { histogram_t* histogram_; }; -class PrometheusStatsFormatterTest : public testing::Test { +class PrometheusStatsFormatterTest : public TestBase { protected: PrometheusStatsFormatterTest() /*: alloc_(stats_options_)*/ {} void addCounter(const std::string& name, std::vector cluster_tags) { diff --git a/test/server/http/config_tracker_impl_test.cc b/test/server/http/config_tracker_impl_test.cc index d085e2c962af9..c89c9ba4f43ac 100644 --- a/test/server/http/config_tracker_impl_test.cc +++ b/test/server/http/config_tracker_impl_test.cc @@ -9,7 +9,7 @@ using testing::_; namespace Envoy { namespace Server { -class ConfigTrackerImplTest : public testing::Test { +class ConfigTrackerImplTest : public TestBase { public: ConfigTrackerImplTest() : cbs_map(tracker.getCallbacksMap()) { EXPECT_TRUE(cbs_map.empty()); diff --git a/test/server/init_manager_impl_test.cc b/test/server/init_manager_impl_test.cc index afaa2e44a0176..1bbeac062ac0e 100644 --- a/test/server/init_manager_impl_test.cc +++ b/test/server/init_manager_impl_test.cc @@ -12,7 +12,7 @@ using testing::Invoke; namespace Envoy { namespace Server { -class InitManagerImplTest : public testing::Test { +class InitManagerImplTest : public TestBase { public: InitManagerImpl manager_; ReadyWatcher initialized_; diff --git a/test/server/lds_api_test.cc b/test/server/lds_api_test.cc index 597716e6c8c28..73a092984c555 100644 --- a/test/server/lds_api_test.cc +++ b/test/server/lds_api_test.cc @@ -22,7 +22,7 @@ using testing::Throw; namespace Envoy { namespace Server { -class LdsApiTest : public testing::Test { +class LdsApiTest : public TestBase { public: LdsApiTest() : request_(&cluster_manager_.async_client_), api_(Api::createApiForTest(store_)) {} diff --git a/test/server/listener_manager_impl_test.cc b/test/server/listener_manager_impl_test.cc index be4c516e742e9..2da9582823033 100644 --- a/test/server/listener_manager_impl_test.cc +++ b/test/server/listener_manager_impl_test.cc @@ -25,12 +25,12 @@ #include "test/test_common/environment.h" #include "test/test_common/registry.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/threadsafe_singleton_injector.h" #include "test/test_common/utility.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" -#include "gtest/gtest.h" using testing::_; using testing::InSequence; @@ -55,7 +55,7 @@ class ListenerHandle { Configuration::FactoryContext* context_{}; }; -class ListenerManagerImplTest : public testing::Test { +class ListenerManagerImplTest : public TestBase { protected: ListenerManagerImplTest() : api_(Api::createApiForTest(stats_)) { ON_CALL(server_, api()).WillByDefault(ReturnRef(*api_)); diff --git a/test/server/options_impl_test.cc b/test/server/options_impl_test.cc index 08bb03ee116ec..dd4b6aaeec84a 100644 --- a/test/server/options_impl_test.cc +++ b/test/server/options_impl_test.cc @@ -9,17 +9,17 @@ #include "server/options_impl.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" #include "spdlog/spdlog.h" using testing::HasSubstr; namespace Envoy { -class OptionsImplTest : public testing::Test { +class OptionsImplTest : public TestBase { public: // Do the ugly work of turning a std::string into a char** and create an OptionsImpl. Args are diff --git a/test/server/overload_manager_impl_test.cc b/test/server/overload_manager_impl_test.cc index 439103650548f..f79598a43ec24 100644 --- a/test/server/overload_manager_impl_test.cc +++ b/test/server/overload_manager_impl_test.cc @@ -10,10 +10,10 @@ #include "test/mocks/event/mocks.h" #include "test/mocks/thread_local/mocks.h" #include "test/test_common/registry.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::Invoke; @@ -69,7 +69,7 @@ class FakeResourceMonitorFactory FakeResourceMonitor* monitor_; // not owned }; -class OverloadManagerImplTest : public testing::Test { +class OverloadManagerImplTest : public TestBase { protected: OverloadManagerImplTest() : factory1_("envoy.resource_monitors.fake_resource1"), diff --git a/test/server/server_test.cc b/test/server/server_test.cc index aebaf8b1e653f..a0d036d5d5435 100644 --- a/test/server/server_test.cc +++ b/test/server/server_test.cc @@ -11,11 +11,10 @@ #include "test/mocks/server/mocks.h" #include "test/mocks/stats/mocks.h" #include "test/test_common/environment.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::_; using testing::Assign; using testing::HasSubstr; @@ -54,7 +53,7 @@ TEST(ServerInstanceUtil, flushHelper) { InstanceUtil::flushMetricsToSinks(sinks, source); } -class RunHelperTest : public testing::Test { +class RunHelperTest : public TestBase { public: RunHelperTest() : shutdown_(false) { InSequence s; @@ -113,7 +112,7 @@ TEST_F(RunHelperTest, ShutdownBeforeInitManagerInit) { } // Class creates minimally viable server instance for testing. -class ServerInstanceImplTest : public testing::TestWithParam { +class ServerInstanceImplTest : public TestBaseWithParam { protected: ServerInstanceImplTest() : version_(GetParam()) {} diff --git a/test/server/worker_impl_test.cc b/test/server/worker_impl_test.cc index 398e59e2e5719..0be4f48732037 100644 --- a/test/server/worker_impl_test.cc +++ b/test/server/worker_impl_test.cc @@ -6,11 +6,10 @@ #include "test/mocks/network/mocks.h" #include "test/mocks/server/mocks.h" #include "test/mocks/thread_local/mocks.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using testing::_; using testing::InSequence; using testing::Invoke; @@ -22,7 +21,7 @@ using testing::Throw; namespace Envoy { namespace Server { -class WorkerImplTest : public testing::Test { +class WorkerImplTest : public TestBase { public: WorkerImplTest() : api_(Api::createApiForTest(stats_store_)) { // In the real worker the watchdog has timers that prevent exit. Here we need to prevent event diff --git a/test/test_common/BUILD b/test/test_common/BUILD index 4b164f56c4b55..0aa8c4956b797 100644 --- a/test/test_common/BUILD +++ b/test/test_common/BUILD @@ -137,7 +137,7 @@ envoy_cc_library( ], ) -envoy_cc_test_library( +envoy_cc_library( name = "global_lib", srcs = ["global.cc"], hdrs = ["global.h"], @@ -155,6 +155,16 @@ envoy_cc_test( ], ) +envoy_cc_library( + name = "test_base", + srcs = ["test_base.cc"], + hdrs = ["test_base.h"], + deps = [ + "//external:googletest", + "//test/test_common:global_lib", + ], +) + envoy_cc_test_library( name = "test_time_lib", srcs = ["test_time.cc"], diff --git a/test/test_common/environment.cc b/test/test_common/environment.cc index 87cdadacb427c..5097558f1ff95 100644 --- a/test/test_common/environment.cc +++ b/test/test_common/environment.cc @@ -27,7 +27,7 @@ #include "test/test_common/network_utility.h" #include "absl/strings/match.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" #include "spdlog/spdlog.h" namespace Envoy { diff --git a/test/test_common/global_test.cc b/test/test_common/global_test.cc index bd6bb56746600..901da205f9249 100644 --- a/test/test_common/global_test.cc +++ b/test/test_common/global_test.cc @@ -2,13 +2,12 @@ #include #include "test/test_common/global.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Test { -class GlobalTest : public testing::Test { +class GlobalTest : public TestBase { protected: }; diff --git a/test/test_common/network_utility_test.cc b/test/test_common/network_utility_test.cc index 9d58e523abdef..97fd38fb24f5c 100644 --- a/test/test_common/network_utility_test.cc +++ b/test/test_common/network_utility_test.cc @@ -2,14 +2,13 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Network { namespace Test { -class NetworkUtilityTest : public testing::TestWithParam { +class NetworkUtilityTest : public TestBaseWithParam { protected: NetworkUtilityTest() : version_(GetParam()) {} const Address::IpVersion version_; diff --git a/test/test_common/registry.h b/test/test_common/registry.h index 0cdcd8f5afd74..c1b04c8ba6f19 100644 --- a/test/test_common/registry.h +++ b/test/test_common/registry.h @@ -2,7 +2,7 @@ #include "envoy/registry/registry.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" namespace Envoy { namespace Registry { diff --git a/test/test_common/simulated_time_system_test.cc b/test/test_common/simulated_time_system_test.cc index 3dcd5a6278681..ddc7db5dcae57 100644 --- a/test/test_common/simulated_time_system_test.cc +++ b/test/test_common/simulated_time_system_test.cc @@ -2,16 +2,16 @@ #include "common/event/libevent.h" #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" #include "event2/event.h" -#include "gtest/gtest.h" namespace Envoy { namespace Event { namespace Test { -class SimulatedTimeSystemTest : public testing::Test { +class SimulatedTimeSystemTest : public TestBase { protected: SimulatedTimeSystemTest() : event_system_(event_base_new()), scheduler_(time_system_.createScheduler(event_system_)), diff --git a/test/test_common/test_base.cc b/test/test_common/test_base.cc new file mode 100644 index 0000000000000..2e5b9d72bb301 --- /dev/null +++ b/test/test_common/test_base.cc @@ -0,0 +1,19 @@ +#include "test/test_common/test_base.h" + +#include "test/test_common/global.h" + +namespace Envoy { + +bool TestBase::checkSingletonQuiescensce() { + // Check that all singletons have been destroyed. + std::string active_singletons = Envoy::Test::Globals::describeActiveSingletons(); + if (!active_singletons.empty()) { + std::cerr << "\n\nFAIL: Active singletons exist:\n" << active_singletons << std::endl; + return false; + } + return true; +} + +TestBase::~TestBase() { checkSingletonQuiescensce(); } + +} // namespace Envoy diff --git a/test/test_common/test_base.h b/test/test_common/test_base.h new file mode 100644 index 0000000000000..c4044fe6b745d --- /dev/null +++ b/test/test_common/test_base.h @@ -0,0 +1,21 @@ +#pragma once + +#include "gtest/gtest.h" + +namespace Envoy { + +// Provides a common test-base class for all tests in Envoy to use. This offers +// a place to put hooks we'd like to run on every tests. +class TestBase : public ::testing::Test { +public: + static bool checkSingletonQuiescensce(); + ~TestBase() override; +}; + +// Templatized version of TestBase. +template class TestBaseWithParam : public ::testing::TestWithParam { +public: + ~TestBaseWithParam() { TestBase::checkSingletonQuiescensce(); } +}; + +} // namespace Envoy diff --git a/test/test_common/test_time_system_test.cc b/test/test_common/test_time_system_test.cc index 30268d3fe6bfa..27fc24cab94ca 100644 --- a/test/test_common/test_time_system_test.cc +++ b/test/test_common/test_time_system_test.cc @@ -1,15 +1,14 @@ #include "test/test_common/simulated_time_system.h" +#include "test/test_common/test_base.h" #include "test/test_common/test_time.h" #include "test/test_common/test_time_system.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - namespace Envoy { namespace Event { namespace Test { -class TestTimeSystemTest : public testing::Test { +class TestTimeSystemTest : public TestBase { protected: }; diff --git a/test/test_common/utility.cc b/test/test_common/utility.cc index 2040262085c75..4b10d5208c446 100644 --- a/test/test_common/utility.cc +++ b/test/test_common/utility.cc @@ -41,7 +41,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" using testing::GTEST_FLAG(random_seed); diff --git a/test/test_common/utility.h b/test/test_common/utility.h index 4b36e2082d2c4..02726229002c2 100644 --- a/test/test_common/utility.h +++ b/test/test_common/utility.h @@ -24,10 +24,10 @@ #include "common/stats/raw_stat_data.h" #include "test/test_common/printers.h" +#include "test/test_common/test_base.h" #include "absl/time/time.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" using testing::_; using testing::AssertionFailure; @@ -285,7 +285,7 @@ class TestUtility { // Tests using this will be of the form IpVersions/SslSocketTest.HalfClose/IPv4 // instead of IpVersions/SslSocketTest.HalfClose/1 static std::string - ipTestParamsToString(const testing::TestParamInfo& params) { + ipTestParamsToString(const ::testing::TestParamInfo& params) { return params.param == Network::Address::IpVersion::v4 ? "IPv4" : "IPv6"; } diff --git a/test/test_common/utility_test.cc b/test/test_common/utility_test.cc index 40083fe339469..347440eea7478 100644 --- a/test/test_common/utility_test.cc +++ b/test/test_common/utility_test.cc @@ -1,7 +1,6 @@ +#include "test/test_common/test_base.h" #include "test/test_common/utility.h" -#include "gtest/gtest.h" - using Envoy::Http::HeaderMap; namespace Envoy { diff --git a/test/test_runner.h b/test/test_runner.h index 7893ddf597abe..34754d376de16 100644 --- a/test/test_runner.h +++ b/test/test_runner.h @@ -7,10 +7,9 @@ #include "test/mocks/access_log/mocks.h" #include "test/test_common/environment.h" -#include "test/test_common/global.h" +#include "test/test_common/test_base.h" #include "gmock/gmock.h" -#include "gtest/gtest.h" namespace Envoy { class TestRunner { @@ -27,8 +26,8 @@ class TestRunner { // (https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#logging-additional-information), // they are available in the test XML. // TODO(htuch): Log these as well? - ::testing::Test::RecordProperty("TemporaryDirectory", TestEnvironment::temporaryDirectory()); - ::testing::Test::RecordProperty("RunfilesDirectory", TestEnvironment::runfilesDirectory()); + TestBase::RecordProperty("TemporaryDirectory", TestEnvironment::temporaryDirectory()); + TestBase::RecordProperty("RunfilesDirectory", TestEnvironment::runfilesDirectory()); TestEnvironment::setEnvVar("TEST_UDSDIR", TestEnvironment::unixDomainSocketDirectory(), 1); @@ -49,9 +48,7 @@ class TestRunner { int exit_status = RUN_ALL_TESTS(); // Check that all singletons have been destroyed. - std::string active_singletons = Test::Globals::describeActiveSingletons(); - if (!active_singletons.empty()) { - std::cerr << "\n\nFAIL: Active singletons exist:\n" << active_singletons << std::endl; + if (!TestBase::checkSingletonQuiescensce()) { exit_status = EXIT_FAILURE; } diff --git a/test/tools/config_load_check/config_load_check.cc b/test/tools/config_load_check/config_load_check.cc index a36e531c53b16..dbbacdb499977 100644 --- a/test/tools/config_load_check/config_load_check.cc +++ b/test/tools/config_load_check/config_load_check.cc @@ -9,8 +9,7 @@ #include "common/event/libevent.h" #include "test/config_test/config_test.h" - -#include "gtest/gtest.h" +#include "test/test_common/test_base.h" int main(int argc, char* argv[]) { if (argc != 2) { diff --git a/tools/check_format.py b/tools/check_format.py index 6468a275a97a7..9d43977ca6e42 100755 --- a/tools/check_format.py +++ b/tools/check_format.py @@ -380,6 +380,11 @@ def checkSourceLine(line, file_path, reportError): reportError("Don't use the '?:' operator, it is a non-standard GCC extension") if line.startswith('using testing::Test;'): reportError("Don't use 'using testing::Test;, elaborate the type instead") + if line.startswith('using testing::TestWithParams;'): + reportError("Don't use 'using testing::Test;, elaborate the type instead") + if file_path != './test/test_common/test_base.h' and (' testing::Test ' in line or + ' testing::TestWithParam' in line): + reportError("Derive test classes from TestBase in test/test_common/test_base.h") def checkBuildLine(line, file_path, reportError):