Skip to content

Wrap the realtime RC test in flaky-block to automatically retry. #1406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 31, 2023
Merged
Changes from 2 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
6 changes: 4 additions & 2 deletions remote_config/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ TEST_F(FirebaseRemoteConfigTest, TestSetDefault) {
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.
EXPECT_TRUE(WaitForCompletion(SetDefaults(rc_), "SetDefaults"));
Expand Down Expand Up @@ -302,6 +303,7 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
firebase::remote_config::RemoteConfigError) {});
#else
auto config_update_promise = std::make_shared<std::promise<void> >();
auto config_update_future = config_update_promise->get_future();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is all this promise stuff just used for the delay?

Copy link
Contributor Author

@AlmostMatt AlmostMatt Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea the promise+future is used just to verify that the callback is called.
The promise is used to set a value, and the corresponding future is used to read the value once it has been set. This change to the order of the lines is not functional, just defining the two variables together.


firebase::remote_config::ConfigUpdateListenerRegistration registration =
rc_->AddOnConfigUpdateListener(
Expand All @@ -312,9 +314,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.
Expand All @@ -333,6 +334,7 @@ TEST_F(FirebaseRemoteConfigTest, TestAddOnConfigUpdateListener) {
registration.Remove();
}
#endif // !FIREBASE_PLATFORM_DESKTOP
FLAKY_TEST_SECTION_END();
}

TEST_F(FirebaseRemoteConfigTest, TestRemoveConfigUpdateListener) {
Expand Down