Skip to content

Commit

Permalink
redis: Fix stack-use-after-scope in test (#10840)
Browse files Browse the repository at this point in the history
Signed-off-by: Ruslan Nigmatullin <elessar@dropbox.com>
  • Loading branch information
Ruslan Nigmatullin authored Apr 21, 2020
1 parent b3fe5f7 commit ed55058
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/extensions/clusters/redis/redis_cluster_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ class RedisClusterTest : public testing::Test,
Network::DnsResolver::ResolutionStatus status =
Network::DnsResolver::ResolutionStatus::Success) {
EXPECT_CALL(*dns_resolver_, resolve(expected_address, dns_lookup_family, _))
.WillOnce(Invoke([&](const std::string&, Network::DnsLookupFamily,
.WillOnce(Invoke([status, resolved_addresses](
const std::string&, Network::DnsLookupFamily,
Network::DnsResolver::ResolveCb cb) -> Network::ActiveDnsQuery* {
cb(status, TestUtility::makeDnsResponse(resolved_addresses));
return nullptr;
Expand Down Expand Up @@ -685,7 +686,7 @@ TEST_F(RedisClusterTest, FailedDnsResponse) {

EXPECT_EQ(0UL, cluster_->prioritySet().hostSetsPerPriority()[0]->hosts().size());
EXPECT_EQ(0UL, cluster_->prioritySet().hostSetsPerPriority()[0]->healthyHosts().size());
EXPECT_EQ(1U, cluster_->info()->stats().update_empty_.value());
EXPECT_EQ(0U, cluster_->info()->stats().update_empty_.value());

// Does not recreate the timer on subsequent DNS resolve calls.
EXPECT_CALL(*dns_timer, enableTimer(_, _));
Expand All @@ -694,7 +695,7 @@ TEST_F(RedisClusterTest, FailedDnsResponse) {

EXPECT_EQ(0UL, cluster_->prioritySet().hostSetsPerPriority()[0]->hosts().size());
EXPECT_EQ(0UL, cluster_->prioritySet().hostSetsPerPriority()[0]->healthyHosts().size());
EXPECT_EQ(2U, cluster_->info()->stats().update_empty_.value());
EXPECT_EQ(1U, cluster_->info()->stats().update_empty_.value());
}

TEST_F(RedisClusterTest, Basic) {
Expand Down

0 comments on commit ed55058

Please sign in to comment.