From 3d179fe401f7d1af9db9cd328ba96f30c178b2c2 Mon Sep 17 00:00:00 2001 From: "almostmatt@google.com" Date: Thu, 27 Jul 2023 12:38:08 -0400 Subject: [PATCH 1/4] Wrap the realtime RC test in flaky block to see if retry after a delay fixes it --- remote_config/integration_test/src/integration_test.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/remote_config/integration_test/src/integration_test.cc b/remote_config/integration_test/src/integration_test.cc index 4bc466276c..f231e29895 100644 --- a/remote_config/integration_test/src/integration_test.cc +++ b/remote_config/integration_test/src/integration_test.cc @@ -264,7 +264,9 @@ TEST_F(FirebaseRemoteConfigTest, TestSetDefault) { /// This test requires to be run on a device or simulator that does not have the /// template version number stored on the disk or auto-fetch will be skipped. TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { + ASSERT_NE(rc_, nullptr); + FLAKY_TEST_SECTION_BEGIN(); // Check if the config has default values. If not, we have cached data // from a previous test run, and auto-fetch will not happen. @@ -302,6 +304,7 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { firebase::remote_config::RemoteConfigError) {}); #else auto config_update_promise = std::make_shared >(); + auto config_update_future = config_update_promise->get_future(); firebase::remote_config::ConfigUpdateListenerRegistration registration = rc_->AddOnConfigUpdateListener( @@ -312,9 +315,8 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { config_update_promise->set_value(); }); if (!has_cached_data) { - auto config_update_future = config_update_promise->get_future(); ASSERT_EQ(std::future_status::ready, - config_update_future.wait_for(std::chrono::milliseconds(30000))); + config_update_future.wait_for(std::chrono::milliseconds(20000))); // On Android WaitForCompletion must be called from the main thread, // so Activate is called here outside of the listener. @@ -333,6 +335,7 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { registration.Remove(); } #endif // !FIREBASE_PLATFORM_DESKTOP + FLAKY_TEST_SECTION_END(); } TEST_F(FirebaseRemoteConfigTest, TestRemoveConfigUpdateListener) { From 305f149c6d840e46ab95de6ce924a6601208c82f Mon Sep 17 00:00:00 2001 From: "almostmatt@google.com" Date: Thu, 27 Jul 2023 12:57:31 -0400 Subject: [PATCH 2/4] whitespace --- remote_config/integration_test/src/integration_test.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/remote_config/integration_test/src/integration_test.cc b/remote_config/integration_test/src/integration_test.cc index f231e29895..e821f357a9 100644 --- a/remote_config/integration_test/src/integration_test.cc +++ b/remote_config/integration_test/src/integration_test.cc @@ -264,10 +264,9 @@ TEST_F(FirebaseRemoteConfigTest, TestSetDefault) { /// This test requires to be run on a device or simulator that does not have the /// template version number stored on the disk or auto-fetch will be skipped. TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { - ASSERT_NE(rc_, nullptr); - FLAKY_TEST_SECTION_BEGIN(); + FLAKY_TEST_SECTION_BEGIN(); // Check if the config has default values. If not, we have cached data // from a previous test run, and auto-fetch will not happen. EXPECT_TRUE(WaitForCompletion(SetDefaults(rc_), "SetDefaults")); From fe3a90ae74f7f32f79da771734829607d1fe6198 Mon Sep 17 00:00:00 2001 From: "almostmatt@google.com" Date: Fri, 28 Jul 2023 19:55:06 -0400 Subject: [PATCH 3/4] Only flaky_test on android --- remote_config/integration_test/src/integration_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/remote_config/integration_test/src/integration_test.cc b/remote_config/integration_test/src/integration_test.cc index e821f357a9..1612b92890 100644 --- a/remote_config/integration_test/src/integration_test.cc +++ b/remote_config/integration_test/src/integration_test.cc @@ -266,7 +266,10 @@ TEST_F(FirebaseRemoteConfigTest, TestSetDefault) { TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { ASSERT_NE(rc_, nullptr); + // This test sometimes times out on Android with the config not updated. +#if defined(__ANDROID__) FLAKY_TEST_SECTION_BEGIN(); +#endif // defined(__ANDROID__) // Check if the config has default values. If not, we have cached data // from a previous test run, and auto-fetch will not happen. EXPECT_TRUE(WaitForCompletion(SetDefaults(rc_), "SetDefaults")); @@ -334,7 +337,10 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { registration.Remove(); } #endif // !FIREBASE_PLATFORM_DESKTOP + // This test sometimes times out on Android with the config not updated. +#if defined(__ANDROID__) FLAKY_TEST_SECTION_END(); +#endif // defined(__ANDROID__) } TEST_F(FirebaseRemoteConfigTest, TestRemoveConfigUpdateListener) { From 64a826bb741c94a8621d10bb9f1285ba8db99751 Mon Sep 17 00:00:00 2001 From: "almostmatt@google.com" Date: Fri, 28 Jul 2023 19:56:52 -0400 Subject: [PATCH 4/4] fix typo --- .../integration_test/src/integration_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/remote_config/integration_test/src/integration_test.cc b/remote_config/integration_test/src/integration_test.cc index 1612b92890..2ce5f145af 100644 --- a/remote_config/integration_test/src/integration_test.cc +++ b/remote_config/integration_test/src/integration_test.cc @@ -328,9 +328,9 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) { std::map key_values = rc_->GetAll(); EXPECT_EQ(key_values.size(), 6); - for (auto key_valur_pair : kServerValue) { - firebase::Variant k_value = key_valur_pair.value; - firebase::Variant fetched_value = key_values[key_valur_pair.key]; + for (auto key_value_pair : kServerValue) { + firebase::Variant k_value = key_value_pair.value; + firebase::Variant fetched_value = key_values[key_value_pair.key]; EXPECT_EQ(k_value.type(), fetched_value.type()); EXPECT_EQ(k_value, fetched_value); } @@ -385,9 +385,9 @@ TEST_F(FirebaseRemoteConfigTest, TestGetAll) { std::map key_values = rc_->GetAll(); EXPECT_EQ(key_values.size(), 6); - for (auto key_valur_pair : kServerValue) { - firebase::Variant k_value = key_valur_pair.value; - firebase::Variant fetched_value = key_values[key_valur_pair.key]; + for (auto key_value_pair : kServerValue) { + firebase::Variant k_value = key_value_pair.value; + firebase::Variant fetched_value = key_values[key_value_pair.key]; EXPECT_EQ(k_value.type(), fetched_value.type()); EXPECT_EQ(k_value, fetched_value); }