Skip to content

Commit

Permalink
increase Firebase timeout to prevent flaky tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
owencooke committed Nov 9, 2023
1 parent aa6db56 commit 73f634a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class DatabaseSetupRule<T extends Activity> implements TestRule {
private final Class<T> activityClass;
private DocumentReference userDoc;
private boolean isDatabaseTest;
private final int dbTimeoutInSeconds = 30;

public DatabaseSetupRule(Class<T> activityClass) {
this.activityClass = activityClass;
Expand Down Expand Up @@ -81,7 +82,7 @@ public void addMockItem(Map<String, Object> itemDetails) throws Exception {
throw new RuntimeException("Adding mock item to Firestore failed with: " + e.getMessage());
});
// Wait for item creation to finish
if (!latch.await(10, TimeUnit.SECONDS)) {
if (!latch.await(dbTimeoutInSeconds, TimeUnit.SECONDS)) {
throw new RuntimeException("Timeout waiting for test user creation.");
}
}
Expand Down Expand Up @@ -122,7 +123,7 @@ private void createTestUser() throws Exception {
}
});
// Wait for user creation to finish
if (!latch.await(10, TimeUnit.SECONDS)) {
if (!latch.await(dbTimeoutInSeconds, TimeUnit.SECONDS)) {
throw new RuntimeException("Timeout waiting for test user creation.");
}
}
Expand All @@ -142,7 +143,7 @@ private void deleteTestUser() throws Exception {
latch.countDown();
});
// Wait for all deletions to finish
if (!latch.await(10, TimeUnit.SECONDS)) {
if (!latch.await(dbTimeoutInSeconds, TimeUnit.SECONDS)) {
throw new RuntimeException("Timeout waiting for test user deletion.");
}
}
Expand Down

0 comments on commit 73f634a

Please sign in to comment.