@@ -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 ++) {
@@ -1100,33 +1109,19 @@ public void resumingAQueryShouldUseBloomFilterToAvoidFullRequery() throws Except
1100
1109
1101
1110
// Verify that the snapshot from the resumed query contains the expected documents; that is,
1102
1111
// that it contains the 50 documents that were _not_ deleted.
1103
- // TODO(b/270731363): Remove the "if" condition below once the Firestore Emulator is fixed to
1104
- // send an existence filter. At the time of writing, the Firestore emulator fails to send an
1105
- // existence filter, resulting in the client including the deleted documents in the snapshot
1106
- // of the resumed query.
1107
- if (!(isRunningAgainstEmulator () && snapshot2 .size () == 100 )) {
1108
- HashSet <String > actualDocumentIds = new HashSet <>();
1109
- for (DocumentSnapshot documentSnapshot : snapshot2 .getDocuments ()) {
1110
- actualDocumentIds .add (documentSnapshot .getId ());
1111
- }
1112
- HashSet <String > expectedDocumentIds = new HashSet <>();
1113
- for (DocumentReference documentRef : createdDocuments ) {
1114
- if (!deletedDocumentIds .contains (documentRef .getId ())) {
1115
- expectedDocumentIds .add (documentRef .getId ());
1116
- }
1117
- }
1118
- assertWithMessage ("snapshot2.docs" )
1119
- .that (actualDocumentIds )
1120
- .containsExactlyElementsIn (expectedDocumentIds );
1112
+ HashSet <String > actualDocumentIds = new HashSet <>();
1113
+ for (DocumentSnapshot documentSnapshot : snapshot2 .getDocuments ()) {
1114
+ actualDocumentIds .add (documentSnapshot .getId ());
1121
1115
}
1122
-
1123
- // Skip the verification of the existence filter mismatch when testing against the Firestore
1124
- // emulator because the Firestore emulator does not include the `unchanged_names` bloom filter
1125
- // when it sends ExistenceFilter messages. Some day the emulator _may_ implement this logic,
1126
- // at which time this short-circuit can be removed.
1127
- if (isRunningAgainstEmulator ()) {
1128
- return ;
1116
+ HashSet <String > expectedDocumentIds = new HashSet <>();
1117
+ for (DocumentReference documentRef : createdDocuments ) {
1118
+ if (!deletedDocumentIds .contains (documentRef .getId ())) {
1119
+ expectedDocumentIds .add (documentRef .getId ());
1120
+ }
1129
1121
}
1122
+ assertWithMessage ("snapshot2.docs" )
1123
+ .that (actualDocumentIds )
1124
+ .containsExactlyElementsIn (expectedDocumentIds );
1130
1125
1131
1126
// Verify that Watch sent an existence filter with the correct counts when the query was
1132
1127
// resumed.
@@ -1175,10 +1170,13 @@ private static String unicodeNormalize(String s) {
1175
1170
1176
1171
@ Test
1177
1172
public void bloomFilterShouldCorrectlyEncodeComplexUnicodeCharacters () throws Exception {
1173
+ // TODO(b/291365820): Stop skipping this test when running against the Firestore emulator once
1174
+ // the emulator is improved to include a bloom filter in the existence filter "messages that it
1175
+ // sends.
1178
1176
assumeFalse (
1179
- "Skip this test when running against the Firestore emulator because the Firestore emulator "
1180
- + "fails to send existence filters when queries are resumed (b/270731363), and even "
1181
- + "if it did send an existence filter it probably wouldn't include a bloom filter." ,
1177
+ "Skip this test when running against the Firestore emulator because the emulator does not "
1178
+ + "include a bloom filter when it sends existence filter messages, making it "
1179
+ + "impossible for this test to verify the correctness of the bloom filter." ,
1182
1180
isRunningAgainstEmulator ());
1183
1181
1184
1182
// Firestore does not do any Unicode normalization on the document IDs. Therefore, two document
0 commit comments