Skip to content

Commit 4029966

Browse files
authored
Refactor Remote Config deflake to use cleaner std::function version. (#545)
1 parent 0e5f937 commit 4029966

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

remote_config/integration_test/src/integration_test.cc

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,8 @@ TEST_F(FirebaseRemoteConfigTest, TestGetAll) {
277277
ASSERT_NE(rc_, nullptr);
278278

279279
EXPECT_TRUE(WaitForCompletion(SetDefaults(rc_), "SetDefaults"));
280-
EXPECT_TRUE(WaitForCompletion(
281-
RunWithRetry([](RemoteConfig* rc) { return rc->Fetch(); }, rc_),
282-
"Fetch"));
280+
EXPECT_TRUE(
281+
WaitForCompletion(RunWithRetry([&]() { return rc_->Fetch(); }), "Fetch"));
283282
EXPECT_TRUE(WaitForCompletion(rc_->Activate(), "Activate"));
284283
std::map<std::string, firebase::Variant> key_values = rc_->GetAll();
285284
EXPECT_EQ(key_values.size(), 6);
@@ -303,9 +302,8 @@ TEST_F(FirebaseRemoteConfigTest, TestFetch) {
303302
ASSERT_NE(rc_, nullptr);
304303

305304
EXPECT_TRUE(WaitForCompletion(SetDefaults(rc_), "SetDefaults"));
306-
EXPECT_TRUE(WaitForCompletion(
307-
RunWithRetry([](RemoteConfig* rc) { return rc->Fetch(); }, rc_),
308-
"Fetch"));
305+
EXPECT_TRUE(
306+
WaitForCompletion(RunWithRetry([&]() { return rc_->Fetch(); }), "Fetch"));
309307
EXPECT_TRUE(WaitForCompletion(rc_->Activate(), "Activate"));
310308
LogDebug("Fetch time: %lld", rc_->GetInfo().fetch_time);
311309
firebase::remote_config::ValueInfo value_info;
@@ -347,27 +345,24 @@ TEST_F(FirebaseRemoteConfigTest, TestFetch) {
347345

348346
TEST_F(FirebaseRemoteConfigTest, TestFetchInterval) {
349347
ASSERT_NE(rc_, nullptr);
350-
EXPECT_TRUE(WaitForCompletion(
351-
RunWithRetry([](RemoteConfig* rc) { return rc->FetchAndActivate(); },
352-
rc_),
353-
"FetchAndActivate"));
348+
EXPECT_TRUE(
349+
WaitForCompletion(RunWithRetry([&]() { return rc_->FetchAndActivate(); }),
350+
"FetchAndActivate"));
354351
uint64_t current_fetch_time = rc_->GetInfo().fetch_time;
355352
// Making sure the config settings's fetch interval is 12 hours
356353
EXPECT_TRUE(WaitForCompletion(SetDefaultConfigSettings(rc_),
357354
"SetDefaultConfigSettings"));
358355
// Second fetch, should respect fetch interval and don't change data.
359-
EXPECT_TRUE(WaitForCompletion(
360-
RunWithRetry([](RemoteConfig* rc) { return rc->Fetch(); }, rc_),
361-
"Fetch"));
356+
EXPECT_TRUE(
357+
WaitForCompletion(RunWithRetry([&]() { return rc_->Fetch(); }), "Fetch"));
362358
EXPECT_EQ(current_fetch_time, rc_->GetInfo().fetch_time);
363359
// Update fetch interval to 0
364360
EXPECT_TRUE(WaitForCompletion(SetZeroIntervalConfigSettings(rc_),
365361
"SetZeroIntervalConfigSettings"));
366362
EXPECT_EQ(0, rc_->GetConfigSettings().minimum_fetch_interval_in_milliseconds);
367363
// Third fetch, this should operate the real fetch and update the fetch time.
368-
EXPECT_TRUE(WaitForCompletion(
369-
RunWithRetry([](RemoteConfig* rc) { return rc->Fetch(); }, rc_),
370-
"Fetch"));
364+
EXPECT_TRUE(
365+
WaitForCompletion(RunWithRetry([&]() { return rc_->Fetch(); }), "Fetch"));
371366
EXPECT_NE(current_fetch_time, rc_->GetInfo().fetch_time);
372367
}
373368

0 commit comments

Comments
 (0)