Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions test/common/config/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ TEST(UtilityTest, UnixClusterStatic) {
}

TEST(UtilityTest, CheckFilesystemSubscriptionBackingPath) {
Stats::MockIsolatedStatsStore stats_store;
Api::ApiPtr api = Api::createApiForTest(stats_store);
Api::ApiPtr api = Api::createApiForTest();

EXPECT_THROW_WITH_MESSAGE(
Utility::checkFilesystemSubscriptionBackingPath("foo", *api), EnvoyException,
Expand Down
8 changes: 3 additions & 5 deletions test/common/event/dispatcher_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class TestDeferredDeletable : public DeferredDeletable {

TEST(DeferredDeleteTest, DeferredDelete) {
InSequence s;
Stats::IsolatedStoreImpl stats_store;
Api::ApiPtr api = Api::createApiForTest(stats_store);
Api::ApiPtr api = Api::createApiForTest();
DispatcherImpl dispatcher(*api);
ReadyWatcher watcher1;

Expand Down Expand Up @@ -62,8 +61,8 @@ TEST(DeferredDeleteTest, DeferredDelete) {
class DispatcherImplTest : public TestBase {
protected:
DispatcherImplTest()
: api_(Api::createApiForTest(stat_store_)),
dispatcher_(std::make_unique<DispatcherImpl>(*api_)), work_finished_(false) {
: api_(Api::createApiForTest()), dispatcher_(std::make_unique<DispatcherImpl>(*api_)),
work_finished_(false) {
dispatcher_thread_ = api_->threadFactory().createThread([this]() {
// Must create a keepalive timer to keep the dispatcher from exiting.
std::chrono::milliseconds time_interval(500);
Expand All @@ -80,7 +79,6 @@ class DispatcherImplTest : public TestBase {
dispatcher_thread_->join();
}

Stats::IsolatedStoreImpl stat_store_;
Api::ApiPtr api_;
Thread::ThreadPtr dispatcher_thread_;
DispatcherPtr dispatcher_;
Expand Down
6 changes: 2 additions & 4 deletions test/common/event/file_event_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Event {

class FileEventImplTest : public TestBase {
public:
FileEventImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
FileEventImplTest() : api_(Api::createApiForTest()), dispatcher_(*api_) {}

void SetUp() override {
int rc = socketpair(AF_UNIX, SOCK_DGRAM, 0, fds_);
Expand All @@ -32,7 +32,6 @@ class FileEventImplTest : public TestBase {

protected:
int fds_[2];
Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
DispatcherImpl dispatcher_;
};
Expand All @@ -52,8 +51,7 @@ TEST_P(FileEventImplActivateTest, Activate) {
}
ASSERT_NE(-1, fd);

Stats::IsolatedStoreImpl stats_store;
Api::ApiPtr api = Api::createApiForTest(stats_store);
Api::ApiPtr api = Api::createApiForTest();
DispatcherImpl dispatcher(*api);
ReadyWatcher read_event;
EXPECT_CALL(read_event, ready()).Times(1);
Expand Down
4 changes: 1 addition & 3 deletions test/common/filesystem/watcher_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "common/common/assert.h"
#include "common/event/dispatcher_impl.h"
#include "common/filesystem/watcher_impl.h"
#include "common/stats/isolated_store_impl.h"

#include "test/test_common/environment.h"
#include "test/test_common/test_base.h"
Expand All @@ -17,9 +16,8 @@ namespace Filesystem {

class WatcherImplTest : public TestBase {
protected:
WatcherImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
WatcherImplTest() : api_(Api::createApiForTest()), dispatcher_(*api_) {}

Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
Event::DispatcherImpl dispatcher_;
};
Expand Down
3 changes: 1 addition & 2 deletions test/common/grpc/async_client_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ namespace {

class AsyncClientManagerImplTest : public TestBase {
public:
AsyncClientManagerImplTest() : api_(Api::createApiForTest(api_stats_store_)) {}
AsyncClientManagerImplTest() : api_(Api::createApiForTest()) {}

Upstream::MockClusterManager cm_;
NiceMock<ThreadLocal::MockInstance> tls_;
Stats::IsolatedStoreImpl api_stats_store_;
Stats::MockStore scope_;
DangerousDeprecatedTestTime test_time_;
Api::ApiPtr api_;
Expand Down
3 changes: 1 addition & 2 deletions test/common/grpc/google_grpc_creds_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ namespace {

class CredsUtilityTest : public TestBase {
public:
CredsUtilityTest() : api_(Api::createApiForTest(stats_store_)) {}
CredsUtilityTest() : api_(Api::createApiForTest()) {}

Stats::MockIsolatedStatsStore stats_store_;
Api::ApiPtr api_;
};

Expand Down
3 changes: 1 addition & 2 deletions test/common/http/codec_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ TEST_F(CodecClientTest, WatermarkPassthrough) {
// Test the codec getting input from a real TCP connection.
class CodecNetworkTest : public TestBaseWithParam<Network::Address::IpVersion> {
public:
CodecNetworkTest() : api_(Api::createApiForTest(stats_store_)) {
CodecNetworkTest() : api_(Api::createApiForTest()) {
dispatcher_ = std::make_unique<Event::DispatcherImpl>(*api_);
upstream_listener_ = dispatcher_->createListener(socket_, listener_callbacks_, true, false);
Network::ClientConnectionPtr client_connection = dispatcher_->createClientConnection(
Expand Down Expand Up @@ -326,7 +326,6 @@ class CodecNetworkTest : public TestBaseWithParam<Network::Address::IpVersion> {
}

protected:
Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
Event::DispatcherPtr dispatcher_;
Network::ListenerPtr upstream_listener_;
Expand Down
3 changes: 1 addition & 2 deletions test/common/http/http1/conn_pool_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ConnPoolImplForTest : public ConnPoolImpl {
NiceMock<Event::MockTimer>* upstream_ready_timer)
: ConnPoolImpl(dispatcher, Upstream::makeTestHost(cluster, "tcp://127.0.0.1:9000"),
Upstream::ResourcePriority::Default, nullptr),
api_(Api::createApiForTest(stats_store_)), mock_dispatcher_(dispatcher),
api_(Api::createApiForTest()), mock_dispatcher_(dispatcher),
mock_upstream_ready_timer_(upstream_ready_timer) {}

~ConnPoolImplForTest() {
Expand Down Expand Up @@ -111,7 +111,6 @@ class ConnPoolImplForTest : public ConnPoolImpl {
EXPECT_FALSE(upstream_ready_enabled_);
}

Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
Event::MockDispatcher& mock_dispatcher_;
NiceMock<Event::MockTimer>* mock_upstream_ready_timer_;
Expand Down
3 changes: 1 addition & 2 deletions test/common/json/config_schemas_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ std::vector<std::string> generateTestInputs() {

class ConfigSchemasTest : public TestBaseWithParam<std::string> {
protected:
ConfigSchemasTest() : api_(Api::createApiForTest(stats_store_)) {}
ConfigSchemasTest() : api_(Api::createApiForTest()) {}

Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
};

Expand Down
3 changes: 1 addition & 2 deletions test/common/json/json_loader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ namespace Json {

class JsonLoaderTest : public TestBase {
protected:
JsonLoaderTest() : api_(Api::createApiForTest(stats_store_)) {}
JsonLoaderTest() : api_(Api::createApiForTest()) {}

Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
};

Expand Down
12 changes: 4 additions & 8 deletions test/common/network/connection_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ INSTANTIATE_TEST_SUITE_P(IpVersions, ConnectionImplDeathTest,
TestUtility::ipTestParamsToString);

TEST_P(ConnectionImplDeathTest, BadFd) {
Stats::IsolatedStoreImpl stats_store;
Event::SimulatedTimeSystem time_system;
Api::ApiPtr api = Api::createApiForTest(stats_store);
Api::ApiPtr api = Api::createApiForTest();
Event::DispatcherImpl dispatcher(*api);
IoHandlePtr io_handle = std::make_unique<IoSocketHandle>();
EXPECT_DEATH_LOG_TO_STDERR(
Expand All @@ -92,7 +91,7 @@ TEST_P(ConnectionImplDeathTest, BadFd) {

class ConnectionImplTest : public TestBaseWithParam<Address::IpVersion> {
public:
ConnectionImplTest() : api_(Api::createApiForTest(stats_store_)) {}
ConnectionImplTest() : api_(Api::createApiForTest()) {}

void setUpBasicConnection() {
if (dispatcher_.get() == nullptr) {
Expand Down Expand Up @@ -208,7 +207,6 @@ class ConnectionImplTest : public TestBaseWithParam<Address::IpVersion> {

Event::SimulatedTimeSystem time_system_;
Event::DispatcherPtr dispatcher_;
Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
Network::TcpListenSocket socket_{Network::Test::getAnyAddress(GetParam()), nullptr, true};
Network::MockListenerCallbacks listener_callbacks_;
Expand Down Expand Up @@ -1645,9 +1643,8 @@ TEST_P(ReadBufferLimitTest, SomeLimit) {

class TcpClientConnectionImplTest : public TestBaseWithParam<Address::IpVersion> {
protected:
TcpClientConnectionImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
TcpClientConnectionImplTest() : api_(Api::createApiForTest()), dispatcher_(*api_) {}

Stats::IsolatedStoreImpl stats_store_;
Event::SimulatedTimeSystem time_system_;
Api::ApiPtr api_;
Event::DispatcherImpl dispatcher_;
Expand Down Expand Up @@ -1689,9 +1686,8 @@ TEST_P(TcpClientConnectionImplTest, BadConnectConnRefused) {

class PipeClientConnectionImplTest : public TestBase {
protected:
PipeClientConnectionImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
PipeClientConnectionImplTest() : api_(Api::createApiForTest()), dispatcher_(*api_) {}

Stats::IsolatedStoreImpl stats_store_;
Event::SimulatedTimeSystem time_system_;
Api::ApiPtr api_;
Event::DispatcherImpl dispatcher_;
Expand Down
6 changes: 2 additions & 4 deletions test/common/network/dns_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,8 @@ class DnsResolverImplPeer {

class DnsImplConstructor : public TestBase {
protected:
DnsImplConstructor() : api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
DnsImplConstructor() : api_(Api::createApiForTest()), dispatcher_(*api_) {}

Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
Event::DispatcherImpl dispatcher_;
};
Expand Down Expand Up @@ -404,7 +403,7 @@ TEST_F(DnsImplConstructor, BadCustomResolvers) {

class DnsImplTest : public TestBaseWithParam<Address::IpVersion> {
public:
DnsImplTest() : api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
DnsImplTest() : api_(Api::createApiForTest()), dispatcher_(*api_) {}

void SetUp() override {
resolver_ = dispatcher_.createDnsResolver({});
Expand Down Expand Up @@ -434,7 +433,6 @@ class DnsImplTest : public TestBaseWithParam<Address::IpVersion> {
std::unique_ptr<DnsResolverImplPeer> peer_;
Network::MockConnectionHandler connection_handler_;
Network::TcpListenSocketPtr socket_;
Stats::IsolatedStoreImpl stats_store_;
std::unique_ptr<Network::Listener> listener_;
Api::ApiPtr api_;
Event::DispatcherImpl dispatcher_;
Expand Down
9 changes: 2 additions & 7 deletions test/common/network/listener_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ namespace Network {
static void errorCallbackTest(Address::IpVersion version) {
// Force the error callback to fire by closing the socket under the listener. We run this entire
// test in the forked process to avoid confusion when the fork happens.
Stats::IsolatedStoreImpl stats_store;
Api::ApiPtr api = Api::createApiForTest(stats_store);
Api::ApiPtr api = Api::createApiForTest();
Event::DispatcherImpl dispatcher(*api);

Network::TcpListenSocket socket(Network::Test::getCanonicalLoopbackAddress(version), nullptr,
Expand Down Expand Up @@ -77,11 +76,10 @@ class ListenerImplTest : public TestBaseWithParam<Address::IpVersion> {
: version_(GetParam()),
alt_address_(Network::Test::findOrCheckFreePort(
Network::Test::getCanonicalLoopbackAddress(version_), Address::SocketType::Stream)),
api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
api_(Api::createApiForTest()), dispatcher_(*api_) {}

const Address::IpVersion version_;
const Address::InstanceConstSharedPtr alt_address_;
Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
Event::DispatcherImpl dispatcher_;
};
Expand Down Expand Up @@ -121,7 +119,6 @@ TEST_P(ListenerImplTest, SetListeningSocketOptionsError) {
}

TEST_P(ListenerImplTest, UseActualDst) {
Stats::IsolatedStoreImpl stats_store;
Network::TcpListenSocket socket(Network::Test::getCanonicalLoopbackAddress(version_), nullptr,
true);
Network::TcpListenSocket socketDst(alt_address_, nullptr, false);
Expand Down Expand Up @@ -158,7 +155,6 @@ TEST_P(ListenerImplTest, UseActualDst) {
}

TEST_P(ListenerImplTest, WildcardListenerUseActualDst) {
Stats::IsolatedStoreImpl stats_store;
Network::TcpListenSocket socket(Network::Test::getAnyAddress(version_), nullptr, true);
Network::MockListenerCallbacks listener_callbacks;
Network::MockConnectionHandler connection_handler;
Expand Down Expand Up @@ -196,7 +192,6 @@ TEST_P(ListenerImplTest, WildcardListenerUseActualDst) {
// local and remote addresses of the connection should be IPv4 instances, as the connection really
// is an IPv4 connection.
TEST_P(ListenerImplTest, WildcardListenerIpv4Compat) {
Stats::IsolatedStoreImpl stats_store;
auto option = std::make_unique<MockSocketOption>();
auto options = std::make_shared<std::vector<Network::Socket::OptionConstSharedPtr>>();
EXPECT_CALL(*option, setOption(_, envoy::api::v2::core::SocketOption::STATE_PREBIND))
Expand Down
3 changes: 1 addition & 2 deletions test/common/network/udp_listener_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class UdpListenerImplTest : public TestBaseWithParam<Address::IpVersion> {
: version_(GetParam()),
alt_address_(Network::Test::findOrCheckFreePort(
Network::Test::getCanonicalLoopbackAddress(version_), Address::SocketType::Stream)),
api_(Api::createApiForTest(stats_store_)), dispatcher_(*api_) {}
api_(Api::createApiForTest()), dispatcher_(*api_) {}

SocketPtr getSocket(Address::SocketType type, const Address::InstanceConstSharedPtr& address,
const Network::Socket::OptionsSharedPtr& options, bool bind) {
Expand Down Expand Up @@ -115,7 +115,6 @@ class UdpListenerImplTest : public TestBaseWithParam<Address::IpVersion> {

const Address::IpVersion version_;
const Address::InstanceConstSharedPtr alt_address_;
Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
DangerousDeprecatedTestTime test_time_;
Event::DispatcherImpl dispatcher_;
Expand Down
3 changes: 1 addition & 2 deletions test/common/protobuf/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ namespace Envoy {

class ProtobufUtilityTest : public TestBase {
protected:
ProtobufUtilityTest() : api_(Api::createApiForTest(stats_store_)) {}
ProtobufUtilityTest() : api_(Api::createApiForTest()) {}

Stats::IsolatedStoreImpl stats_store_;
Api::ApiPtr api_;
};

Expand Down
3 changes: 1 addition & 2 deletions test/common/router/config_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ envoy::api::v2::RouteConfiguration parseRouteConfigurationFromV2Yaml(const std::

class ConfigImplTestBase {
protected:
ConfigImplTestBase() : api_(Api::createApiForTest(stats_)) {
ConfigImplTestBase() : api_(Api::createApiForTest()) {
ON_CALL(factory_context_, api()).WillByDefault(ReturnRef(*api_));
}

Stats::IsolatedStoreImpl stats_;
Api::ApiPtr api_;
NiceMock<Server::Configuration::MockFactoryContext> factory_context_;
};
Expand Down
3 changes: 1 addition & 2 deletions test/common/runtime/runtime_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,8 @@ TEST(LoaderImplTest, All) {

class DiskLayerTest : public TestBase {
protected:
DiskLayerTest() : api_(Api::createApiForTest(store_)) {}
DiskLayerTest() : api_(Api::createApiForTest()) {}

Stats::IsolatedStoreImpl store_;
Api::ApiPtr api_;
};

Expand Down
3 changes: 1 addition & 2 deletions test/common/secret/sds_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ namespace {

class SdsApiTest : public TestBase {
protected:
SdsApiTest() : api_(Api::createApiForTest(stats_store_)) {}
SdsApiTest() : api_(Api::createApiForTest()) {}

Stats::MockIsolatedStatsStore stats_store_;
Api::ApiPtr api_;
};

Expand Down
3 changes: 1 addition & 2 deletions test/common/secret/secret_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ namespace {

class SecretManagerImplTest : public TestBase {
protected:
SecretManagerImplTest() : api_(Api::createApiForTest(stats_store_)) {}
SecretManagerImplTest() : api_(Api::createApiForTest()) {}

Stats::MockIsolatedStatsStore stats_store_;
Api::ApiPtr api_;
};

Expand Down
3 changes: 1 addition & 2 deletions test/common/thread_local/thread_local_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ TEST_F(ThreadLocalInstanceImplTest, RunOnAllThreads) {
TEST(ThreadLocalInstanceImplDispatcherTest, Dispatcher) {
InstanceImpl tls;

Stats::IsolatedStoreImpl stats_store;
Api::ApiPtr api = Api::createApiForTest(stats_store);
Api::ApiPtr api = Api::createApiForTest();
Event::DispatcherImpl main_dispatcher(*api);
Event::DispatcherImpl thread_dispatcher(*api);

Expand Down
3 changes: 1 addition & 2 deletions test/common/upstream/cluster_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ envoy::config::bootstrap::v2::Bootstrap parseBootstrapFromV2Yaml(const std::stri

class ClusterManagerImplTest : public TestBase {
public:
ClusterManagerImplTest() : api_(Api::createApiForTest(stats_store_)) {}
ClusterManagerImplTest() : api_(Api::createApiForTest()) {}

void create(const envoy::config::bootstrap::v2::Bootstrap& bootstrap) {
cluster_manager_ = std::make_unique<ClusterManagerImpl>(
Expand Down Expand Up @@ -239,7 +239,6 @@ class ClusterManagerImplTest : public TestBase {
return metadata;
}

Stats::IsolatedStoreImpl stats_store_;
Event::SimulatedTimeSystem time_system_;
Api::ApiPtr api_;
NiceMock<TestClusterManagerFactory> factory_;
Expand Down
Loading