From e21a418aaef4d2d6541e9d26742b0dc57995b18d Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 4 Oct 2018 12:53:36 -0700 Subject: Add compaction to channelz registry --- test/core/channel/channelz_registry_test.cc | 59 ++++++++++++++++------------- 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'test/core/channel') diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index c02d525c81..02f0968caf 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -43,56 +43,63 @@ namespace grpc_core { namespace channelz { namespace testing { +class ChannelzRegistryPeer { + const InlinedVector* entities() { + return &ChannelzRegistry::Default()->entities_; + } + int num_empty_slots() { + return ChannelzRegistry::Default()->num_empty_slots_; + } +}; + TEST(ChannelzRegistryTest, UuidStartsAboveZeroTest) { - BaseNode* channelz_channel = nullptr; - intptr_t uuid = ChannelzRegistry::Register(channelz_channel); + UniquePtr channelz_channel( + new BaseNode(BaseNode::EntityType::kTopLevelChannel)); + intptr_t uuid = channelz_channel->uuid(); EXPECT_GT(uuid, 0) << "First uuid chose must be greater than zero. Zero if " "reserved according to " "https://github.com/grpc/proposal/blob/master/" "A14-channelz.md"; - ChannelzRegistry::Unregister(uuid); } TEST(ChannelzRegistryTest, UuidsAreIncreasing) { - BaseNode* channelz_channel = nullptr; - std::vector uuids; - uuids.reserve(10); + std::vector> channelz_channels; + channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { - // reregister the same object. It's ok since we are just testing uuids - uuids.push_back(ChannelzRegistry::Register(channelz_channel)); + channelz_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); } - for (size_t i = 1; i < uuids.size(); ++i) { - EXPECT_LT(uuids[i - 1], uuids[i]) << "Uuids must always be increasing"; + for (size_t i = 1; i < channelz_channels.size(); ++i) { + EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid()) + << "Uuids must always be increasing"; } } TEST(ChannelzRegistryTest, RegisterGetTest) { - // we hackily jam an intptr_t into this pointer to check for equality later - BaseNode* channelz_channel = (BaseNode*)42; - intptr_t uuid = ChannelzRegistry::Register(channelz_channel); - BaseNode* retrieved = ChannelzRegistry::Get(uuid); - EXPECT_EQ(channelz_channel, retrieved); + UniquePtr channelz_channel( + new BaseNode(BaseNode::EntityType::kTopLevelChannel)); + BaseNode* retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); + EXPECT_EQ(channelz_channel.get(), retrieved); } TEST(ChannelzRegistryTest, RegisterManyItems) { - // we hackily jam an intptr_t into this pointer to check for equality later - BaseNode* channelz_channel = (BaseNode*)42; + std::vector> channelz_channels; for (int i = 0; i < 100; i++) { - intptr_t uuid = ChannelzRegistry::Register(channelz_channel); - BaseNode* retrieved = ChannelzRegistry::Get(uuid); - EXPECT_EQ(channelz_channel, retrieved); + channelz_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + BaseNode* retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid()); + EXPECT_EQ(channelz_channels[i].get(), retrieved); } } TEST(ChannelzRegistryTest, NullIfNotPresentTest) { - // we hackily jam an intptr_t into this pointer to check for equality later - BaseNode* channelz_channel = (BaseNode*)42; - intptr_t uuid = ChannelzRegistry::Register(channelz_channel); + UniquePtr channelz_channel( + new BaseNode(BaseNode::EntityType::kTopLevelChannel)); // try to pull out a uuid that does not exist. - BaseNode* nonexistant = ChannelzRegistry::Get(uuid + 1); + BaseNode* nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1); EXPECT_EQ(nonexistant, nullptr); - BaseNode* retrieved = ChannelzRegistry::Get(uuid); - EXPECT_EQ(channelz_channel, retrieved); + BaseNode* retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); + EXPECT_EQ(channelz_channel.get(), retrieved); } } // namespace testing -- cgit v1.2.3 From 600124f84f21bfd0bc58d431799826911071528d Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 4 Oct 2018 17:44:51 -0700 Subject: Add tests --- test/core/channel/channelz_registry_test.cc | 100 ++++++++++++++++++++++++++-- 1 file changed, 93 insertions(+), 7 deletions(-) (limited to 'test/core/channel') diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index 02f0968caf..10a63d4d6e 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -44,6 +44,7 @@ namespace channelz { namespace testing { class ChannelzRegistryPeer { + public: const InlinedVector* entities() { return &ChannelzRegistry::Default()->entities_; } @@ -52,7 +53,15 @@ class ChannelzRegistryPeer { } }; -TEST(ChannelzRegistryTest, UuidStartsAboveZeroTest) { +class ChannelzRegistryTest : public ::testing::Test { + protected: + // ensure we always have a fresh registry for tests. + void SetUp() override { ChannelzRegistry::Init(); } + + void TearDown() override { ChannelzRegistry::Shutdown(); } +}; + +TEST_F(ChannelzRegistryTest, UuidStartsAboveZeroTest) { UniquePtr channelz_channel( new BaseNode(BaseNode::EntityType::kTopLevelChannel)); intptr_t uuid = channelz_channel->uuid(); @@ -62,7 +71,7 @@ TEST(ChannelzRegistryTest, UuidStartsAboveZeroTest) { "A14-channelz.md"; } -TEST(ChannelzRegistryTest, UuidsAreIncreasing) { +TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { std::vector> channelz_channels; channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { @@ -75,14 +84,14 @@ TEST(ChannelzRegistryTest, UuidsAreIncreasing) { } } -TEST(ChannelzRegistryTest, RegisterGetTest) { +TEST_F(ChannelzRegistryTest, RegisterGetTest) { UniquePtr channelz_channel( new BaseNode(BaseNode::EntityType::kTopLevelChannel)); BaseNode* retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); EXPECT_EQ(channelz_channel.get(), retrieved); } -TEST(ChannelzRegistryTest, RegisterManyItems) { +TEST_F(ChannelzRegistryTest, RegisterManyItems) { std::vector> channelz_channels; for (int i = 0; i < 100; i++) { channelz_channels.push_back(UniquePtr( @@ -92,7 +101,7 @@ TEST(ChannelzRegistryTest, RegisterManyItems) { } } -TEST(ChannelzRegistryTest, NullIfNotPresentTest) { +TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) { UniquePtr channelz_channel( new BaseNode(BaseNode::EntityType::kTopLevelChannel)); // try to pull out a uuid that does not exist. @@ -102,15 +111,92 @@ TEST(ChannelzRegistryTest, NullIfNotPresentTest) { EXPECT_EQ(channelz_channel.get(), retrieved); } +TEST_F(ChannelzRegistryTest, TestCompaction) { + const int kLoopIterations = 100; + // These channels that will stay in the registry for the duration of the test. + std::vector> even_channels; + even_channels.reserve(kLoopIterations); + { + // The channels will unregister themselves at the end of the for block. + std::vector> odd_channels; + odd_channels.reserve(kLoopIterations); + for (int i = 0; i < kLoopIterations; i++) { + even_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + odd_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + } + } + // without compaction, there would be exactly kLoopIterations empty slots at + // this point. However, one of the unregisters should have triggered + // compaction. + ChannelzRegistryPeer peer; + EXPECT_LT(peer.num_empty_slots(), kLoopIterations); +} + +TEST_F(ChannelzRegistryTest, TestGetAfterCompaction) { + const int kLoopIterations = 100; + // These channels that will stay in the registry for the duration of the test. + std::vector> even_channels; + even_channels.reserve(kLoopIterations); + std::vector odd_uuids; + odd_uuids.reserve(kLoopIterations); + { + // The channels will unregister themselves at the end of the for block. + std::vector> odd_channels; + odd_channels.reserve(kLoopIterations); + for (int i = 0; i < kLoopIterations; i++) { + even_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + odd_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + odd_uuids.push_back(odd_channels[i]->uuid()); + } + } + for (int i = 0; i < kLoopIterations; i++) { + BaseNode* retrieved = ChannelzRegistry::Get(even_channels[i]->uuid()); + EXPECT_EQ(even_channels[i].get(), retrieved); + retrieved = ChannelzRegistry::Get(odd_uuids[i]); + EXPECT_EQ(retrieved, nullptr); + } +} + +TEST_F(ChannelzRegistryTest, TestAddAfterCompaction) { + const int kLoopIterations = 100; + // These channels that will stay in the registry for the duration of the test. + std::vector> even_channels; + even_channels.reserve(kLoopIterations); + std::vector odd_uuids; + odd_uuids.reserve(kLoopIterations); + { + // The channels will unregister themselves at the end of the for block. + std::vector> odd_channels; + odd_channels.reserve(kLoopIterations); + for (int i = 0; i < kLoopIterations; i++) { + even_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + odd_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + odd_uuids.push_back(odd_channels[i]->uuid()); + } + } + std::vector> more_channels; + more_channels.reserve(kLoopIterations); + for (int i = 0; i < kLoopIterations; i++) { + more_channels.push_back(UniquePtr( + new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + BaseNode* retrieved = ChannelzRegistry::Get(more_channels[i]->uuid()); + EXPECT_EQ(more_channels[i].get(), retrieved); + } +} + } // namespace testing } // namespace channelz } // namespace grpc_core int main(int argc, char** argv) { grpc_test_init(argc, argv); - grpc_init(); ::testing::InitGoogleTest(&argc, argv); int ret = RUN_ALL_TESTS(); - grpc_shutdown(); return ret; } -- cgit v1.2.3 From 9317845a97673b0283aae48471cf86eb12e80adc Mon Sep 17 00:00:00 2001 From: ncteisen Date: Thu, 4 Oct 2018 21:43:12 -0700 Subject: Use the right new --- test/core/channel/channelz_registry_test.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'test/core/channel') diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index 10a63d4d6e..7a181d018d 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -76,7 +76,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { channelz_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); } for (size_t i = 1; i < channelz_channels.size(); ++i) { EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid()) @@ -86,7 +86,7 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { TEST_F(ChannelzRegistryTest, RegisterGetTest) { UniquePtr channelz_channel( - new BaseNode(BaseNode::EntityType::kTopLevelChannel)); + New(BaseNode::EntityType::kTopLevelChannel)); BaseNode* retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); EXPECT_EQ(channelz_channel.get(), retrieved); } @@ -95,7 +95,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) { std::vector> channelz_channels; for (int i = 0; i < 100; i++) { channelz_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); BaseNode* retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid()); EXPECT_EQ(channelz_channels[i].get(), retrieved); } @@ -103,7 +103,7 @@ TEST_F(ChannelzRegistryTest, RegisterManyItems) { TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) { UniquePtr channelz_channel( - new BaseNode(BaseNode::EntityType::kTopLevelChannel)); + New(BaseNode::EntityType::kTopLevelChannel)); // try to pull out a uuid that does not exist. BaseNode* nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1); EXPECT_EQ(nonexistant, nullptr); @@ -122,9 +122,9 @@ TEST_F(ChannelzRegistryTest, TestCompaction) { odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { even_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); odd_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); } } // without compaction, there would be exactly kLoopIterations empty slots at @@ -147,9 +147,9 @@ TEST_F(ChannelzRegistryTest, TestGetAfterCompaction) { odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { even_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); odd_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); odd_uuids.push_back(odd_channels[i]->uuid()); } } @@ -174,9 +174,9 @@ TEST_F(ChannelzRegistryTest, TestAddAfterCompaction) { odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { even_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); odd_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); odd_uuids.push_back(odd_channels[i]->uuid()); } } @@ -184,7 +184,7 @@ TEST_F(ChannelzRegistryTest, TestAddAfterCompaction) { more_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { more_channels.push_back(UniquePtr( - new BaseNode(BaseNode::EntityType::kTopLevelChannel))); + New(BaseNode::EntityType::kTopLevelChannel))); BaseNode* retrieved = ChannelzRegistry::Get(more_channels[i]->uuid()); EXPECT_EQ(more_channels[i].get(), retrieved); } -- cgit v1.2.3 From 4b36519c40db7619a335cf3a01ee78730ff2ccdb Mon Sep 17 00:00:00 2001 From: ncteisen Date: Fri, 5 Oct 2018 12:33:03 -0700 Subject: reviewer feedback --- src/core/lib/channel/channelz_registry.cc | 10 +++--- src/core/lib/channel/channelz_registry.h | 6 ++-- test/core/channel/channelz_registry_test.cc | 48 ++++++++++++++--------------- 3 files changed, 32 insertions(+), 32 deletions(-) (limited to 'test/core/channel') diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/lib/channel/channelz_registry.cc index 3cc8bd8ea7..4deb8c29aa 100644 --- a/src/core/lib/channel/channelz_registry.cc +++ b/src/core/lib/channel/channelz_registry.cc @@ -59,7 +59,7 @@ intptr_t ChannelzRegistry::InternalRegister(BaseNode* node) { return ++uuid_generator_; } -void ChannelzRegistry::MaybePerformCompaction() { +void ChannelzRegistry::MaybePerformCompactionLocked() { constexpr double kEmptinessTheshold = 1 / 3; double emptiness_ratio = double(num_empty_slots_) / double(entities_.capacity()); @@ -77,7 +77,7 @@ void ChannelzRegistry::MaybePerformCompaction() { } } -int ChannelzRegistry::FindByUuid(intptr_t target_uuid) { +int ChannelzRegistry::FindByUuidLocked(intptr_t target_uuid) { size_t left = 0; size_t right = entities_.size() - 1; while (left <= right) { @@ -107,11 +107,11 @@ void ChannelzRegistry::InternalUnregister(intptr_t uuid) { GPR_ASSERT(uuid >= 1); MutexLock lock(&mu_); GPR_ASSERT(uuid <= uuid_generator_); - int idx = FindByUuid(uuid); + int idx = FindByUuidLocked(uuid); GPR_ASSERT(idx >= 0); entities_[idx] = nullptr; num_empty_slots_++; - MaybePerformCompaction(); + MaybePerformCompactionLocked(); } BaseNode* ChannelzRegistry::InternalGet(intptr_t uuid) { @@ -119,7 +119,7 @@ BaseNode* ChannelzRegistry::InternalGet(intptr_t uuid) { if (uuid < 1 || uuid > uuid_generator_) { return nullptr; } - int idx = FindByUuid(uuid); + int idx = FindByUuidLocked(uuid); return idx < 0 ? nullptr : entities_[idx]; } diff --git a/src/core/lib/channel/channelz_registry.h b/src/core/lib/channel/channelz_registry.h index f9dacd95a3..9c43d960d3 100644 --- a/src/core/lib/channel/channelz_registry.h +++ b/src/core/lib/channel/channelz_registry.h @@ -87,12 +87,12 @@ class ChannelzRegistry { char* InternalGetTopChannels(intptr_t start_channel_id); char* InternalGetServers(intptr_t start_server_id); - // If entities_ has a over a certain threshold of empty slots, it will + // If entities_ has over a certain threshold of empty slots, it will // compact the vector and move all used slots to the front. - void MaybePerformCompaction(); + void MaybePerformCompactionLocked(); // Performs binary search on entities_ to find the index with that uuid. - int FindByUuid(intptr_t uuid); + int FindByUuidLocked(intptr_t uuid); // protects members gpr_mu mu_; diff --git a/test/core/channel/channelz_registry_test.cc b/test/core/channel/channelz_registry_test.cc index 7a181d018d..fdfc8eec94 100644 --- a/test/core/channel/channelz_registry_test.cc +++ b/test/core/channel/channelz_registry_test.cc @@ -62,8 +62,8 @@ class ChannelzRegistryTest : public ::testing::Test { }; TEST_F(ChannelzRegistryTest, UuidStartsAboveZeroTest) { - UniquePtr channelz_channel( - new BaseNode(BaseNode::EntityType::kTopLevelChannel)); + UniquePtr channelz_channel = + MakeUnique(BaseNode::EntityType::kTopLevelChannel); intptr_t uuid = channelz_channel->uuid(); EXPECT_GT(uuid, 0) << "First uuid chose must be greater than zero. Zero if " "reserved according to " @@ -75,8 +75,8 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { std::vector> channelz_channels; channelz_channels.reserve(10); for (int i = 0; i < 10; ++i) { - channelz_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); + channelz_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); } for (size_t i = 1; i < channelz_channels.size(); ++i) { EXPECT_LT(channelz_channels[i - 1]->uuid(), channelz_channels[i]->uuid()) @@ -85,8 +85,8 @@ TEST_F(ChannelzRegistryTest, UuidsAreIncreasing) { } TEST_F(ChannelzRegistryTest, RegisterGetTest) { - UniquePtr channelz_channel( - New(BaseNode::EntityType::kTopLevelChannel)); + UniquePtr channelz_channel = + MakeUnique(BaseNode::EntityType::kTopLevelChannel); BaseNode* retrieved = ChannelzRegistry::Get(channelz_channel->uuid()); EXPECT_EQ(channelz_channel.get(), retrieved); } @@ -94,16 +94,16 @@ TEST_F(ChannelzRegistryTest, RegisterGetTest) { TEST_F(ChannelzRegistryTest, RegisterManyItems) { std::vector> channelz_channels; for (int i = 0; i < 100; i++) { - channelz_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); + channelz_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); BaseNode* retrieved = ChannelzRegistry::Get(channelz_channels[i]->uuid()); EXPECT_EQ(channelz_channels[i].get(), retrieved); } } TEST_F(ChannelzRegistryTest, NullIfNotPresentTest) { - UniquePtr channelz_channel( - New(BaseNode::EntityType::kTopLevelChannel)); + UniquePtr channelz_channel = + MakeUnique(BaseNode::EntityType::kTopLevelChannel); // try to pull out a uuid that does not exist. BaseNode* nonexistant = ChannelzRegistry::Get(channelz_channel->uuid() + 1); EXPECT_EQ(nonexistant, nullptr); @@ -121,10 +121,10 @@ TEST_F(ChannelzRegistryTest, TestCompaction) { std::vector> odd_channels; odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - even_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); - odd_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); + even_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); + odd_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); } } // without compaction, there would be exactly kLoopIterations empty slots at @@ -146,10 +146,10 @@ TEST_F(ChannelzRegistryTest, TestGetAfterCompaction) { std::vector> odd_channels; odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - even_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); - odd_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); + even_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); + odd_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); odd_uuids.push_back(odd_channels[i]->uuid()); } } @@ -173,18 +173,18 @@ TEST_F(ChannelzRegistryTest, TestAddAfterCompaction) { std::vector> odd_channels; odd_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - even_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); - odd_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); + even_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); + odd_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); odd_uuids.push_back(odd_channels[i]->uuid()); } } std::vector> more_channels; more_channels.reserve(kLoopIterations); for (int i = 0; i < kLoopIterations; i++) { - more_channels.push_back(UniquePtr( - New(BaseNode::EntityType::kTopLevelChannel))); + more_channels.push_back( + MakeUnique(BaseNode::EntityType::kTopLevelChannel)); BaseNode* retrieved = ChannelzRegistry::Get(more_channels[i]->uuid()); EXPECT_EQ(more_channels[i].get(), retrieved); } -- cgit v1.2.3