@@ -1042,6 +1042,15 @@ public void testMultipleUpdatesWhileOffline() {
1042
1042
1043
1043
@ Test
1044
1044
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
+
1045
1054
// Prepare the names and contents of the 100 documents to create.
1046
1055
Map <String , Map <String , Object >> testData = new HashMap <>();
1047
1056
for (int i = 0 ; i < 100 ; i ++) {
@@ -1103,33 +1112,19 @@ public void resumingAQueryShouldUseBloomFilterToAvoidFullRequery() throws Except
1103
1112
1104
1113
// Verify that the snapshot from the resumed query contains the expected documents; that is,
1105
1114
// 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 ());
1124
1118
}
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
+ }
1132
1124
}
1125
+ assertWithMessage ("snapshot2.docs" )
1126
+ .that (actualDocumentIds )
1127
+ .containsExactlyElementsIn (expectedDocumentIds );
1133
1128
1134
1129
// Verify that Watch sent an existence filter with the correct counts when the query was
1135
1130
// resumed.
@@ -1178,10 +1173,13 @@ private static String unicodeNormalize(String s) {
1178
1173
1179
1174
@ Test
1180
1175
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.
1181
1179
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." ,
1185
1183
isRunningAgainstEmulator ());
1186
1184
1187
1185
// Firestore does not do any Unicode normalization on the document IDs. Therefore, two document
0 commit comments