Skip to content

Commit e7573aa

Browse files
authored
Deflake TestInvalidatingReferencesWhenDeletingStorage and App (#589)
These two Storage tests perform network operations (PutBytes and Delete) and should use RunWithRetry.
1 parent ea08dd2 commit e7573aa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

storage/integration_test/src/integration_test.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,11 +901,14 @@ TEST_F(FirebaseStorageTest, TestInvalidatingReferencesWhenDeletingStorage) {
901901
CreateFolder().Child("TestFile-InvalidateReferencesDeletingStorage.txt");
902902
// Don't clean up, will be manually deleted.
903903

904-
WaitForCompletion(ref.PutBytes(&kSimpleTestFile[0], kSimpleTestFile.size()),
904+
WaitForCompletion(RunWithRetry([&]() {
905+
return ref.PutBytes(&kSimpleTestFile[0],
906+
kSimpleTestFile.size());
907+
}),
905908
"PutBytes");
906909
ASSERT_NE(ref.PutBytesLastResult().result(), nullptr);
907910
firebase::storage::Metadata metadata = *ref.PutBytesLastResult().result();
908-
WaitForCompletion(ref.Delete(), "Delete");
911+
WaitForCompletion(RunWithRetry([&]() { return ref.Delete(); }), "Delete");
909912

910913
ASSERT_TRUE(ref.is_valid());
911914
ASSERT_TRUE(metadata.is_valid());
@@ -924,11 +927,14 @@ TEST_F(FirebaseStorageTest, TestInvalidatingReferencesWhenDeletingApp) {
924927
CreateFolder().Child("TestFile-InvalidateReferencesDeletingApp.txt");
925928
// Don't clean up, will be manually deleted.
926929

927-
WaitForCompletion(ref.PutBytes(&kSimpleTestFile[0], kSimpleTestFile.size()),
930+
WaitForCompletion(RunWithRetry([&]() {
931+
return ref.PutBytes(&kSimpleTestFile[0],
932+
kSimpleTestFile.size());
933+
}),
928934
"PutBytes");
929935
ASSERT_NE(ref.PutBytesLastResult().result(), nullptr);
930936
firebase::storage::Metadata metadata = *ref.PutBytesLastResult().result();
931-
WaitForCompletion(ref.Delete(), "Delete");
937+
WaitForCompletion(RunWithRetry([&]() { return ref.Delete(); }), "Delete");
932938

933939
ASSERT_TRUE(ref.is_valid());
934940
ASSERT_TRUE(metadata.is_valid());

0 commit comments

Comments
 (0)