Skip to content

Commit 51b95ed

Browse files
authored
Merge 245519f into 392da5f
2 parents 392da5f + 245519f commit 51b95ed

File tree

1 file changed

+26
-28
lines changed
  • firebase-firestore/src/androidTest/java/com/google/firebase/firestore

1 file changed

+26
-28
lines changed

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryTest.java

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,15 @@ public void testMultipleUpdatesWhileOffline() {
10421042

10431043
@Test
10441044
public void resumingAQueryShouldUseBloomFilterToAvoidFullRequery() throws Exception {
1045+
// TODO(b/291365820): Stop skipping this test when running against the Firestore emulator once
1046+
// the emulator is improved to include a bloom filter in the existence filter "messages that it
1047+
// sends.
1048+
assumeFalse(
1049+
"Skip this test when running against the Firestore emulator because the emulator does not "
1050+
+ "include a bloom filter when it sends existence filter messages, making it "
1051+
+ "impossible for this test to verify the correctness of the bloom filter.",
1052+
isRunningAgainstEmulator());
1053+
10451054
// Prepare the names and contents of the 100 documents to create.
10461055
Map<String, Map<String, Object>> testData = new HashMap<>();
10471056
for (int i = 0; i < 100; i++) {
@@ -1103,33 +1112,19 @@ public void resumingAQueryShouldUseBloomFilterToAvoidFullRequery() throws Except
11031112

11041113
// Verify that the snapshot from the resumed query contains the expected documents; that is,
11051114
// that it contains the 50 documents that were _not_ deleted.
1106-
// TODO(b/270731363): Remove the "if" condition below once the Firestore Emulator is fixed to
1107-
// send an existence filter. At the time of writing, the Firestore emulator fails to send an
1108-
// existence filter, resulting in the client including the deleted documents in the snapshot
1109-
// of the resumed query.
1110-
if (!(isRunningAgainstEmulator() && snapshot2.size() == 100)) {
1111-
HashSet<String> actualDocumentIds = new HashSet<>();
1112-
for (DocumentSnapshot documentSnapshot : snapshot2.getDocuments()) {
1113-
actualDocumentIds.add(documentSnapshot.getId());
1114-
}
1115-
HashSet<String> expectedDocumentIds = new HashSet<>();
1116-
for (DocumentReference documentRef : createdDocuments) {
1117-
if (!deletedDocumentIds.contains(documentRef.getId())) {
1118-
expectedDocumentIds.add(documentRef.getId());
1119-
}
1120-
}
1121-
assertWithMessage("snapshot2.docs")
1122-
.that(actualDocumentIds)
1123-
.containsExactlyElementsIn(expectedDocumentIds);
1115+
HashSet<String> actualDocumentIds = new HashSet<>();
1116+
for (DocumentSnapshot documentSnapshot : snapshot2.getDocuments()) {
1117+
actualDocumentIds.add(documentSnapshot.getId());
11241118
}
1125-
1126-
// Skip the verification of the existence filter mismatch when testing against the Firestore
1127-
// emulator because the Firestore emulator does not include the `unchanged_names` bloom filter
1128-
// when it sends ExistenceFilter messages. Some day the emulator _may_ implement this logic,
1129-
// at which time this short-circuit can be removed.
1130-
if (isRunningAgainstEmulator()) {
1131-
return;
1119+
HashSet<String> expectedDocumentIds = new HashSet<>();
1120+
for (DocumentReference documentRef : createdDocuments) {
1121+
if (!deletedDocumentIds.contains(documentRef.getId())) {
1122+
expectedDocumentIds.add(documentRef.getId());
1123+
}
11321124
}
1125+
assertWithMessage("snapshot2.docs")
1126+
.that(actualDocumentIds)
1127+
.containsExactlyElementsIn(expectedDocumentIds);
11331128

11341129
// Verify that Watch sent an existence filter with the correct counts when the query was
11351130
// resumed.
@@ -1178,10 +1173,13 @@ private static String unicodeNormalize(String s) {
11781173

11791174
@Test
11801175
public void bloomFilterShouldCorrectlyEncodeComplexUnicodeCharacters() throws Exception {
1176+
// TODO(b/291365820): Stop skipping this test when running against the Firestore emulator once
1177+
// the emulator is improved to include a bloom filter in the existence filter "messages that it
1178+
// sends.
11811179
assumeFalse(
1182-
"Skip this test when running against the Firestore emulator because the Firestore emulator "
1183-
+ "fails to send existence filters when queries are resumed (b/270731363), and even "
1184-
+ "if it did send an existence filter it probably wouldn't include a bloom filter.",
1180+
"Skip this test when running against the Firestore emulator because the emulator does not "
1181+
+ "include a bloom filter when it sends existence filter messages, making it "
1182+
+ "impossible for this test to verify the correctness of the bloom filter.",
11851183
isRunningAgainstEmulator());
11861184

11871185
// Firestore does not do any Unicode normalization on the document IDs. Therefore, two document

0 commit comments

Comments
 (0)