Skip to content

Commit 1f2f5c9

Browse files
committed
don't get the whole collection for composite index tests.
1 parent 06091bc commit 1f2f5c9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

Firestore/Example/Tests/Integration/API/FIRCompositeIndexQueryTests.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ - (NSString *)toHashedId:(NSString *)docId {
125125
- (void)assertOnlineAndOfflineResultsMatch:(FIRCollectionReference *)collection
126126
withQuery:(FIRQuery *)query
127127
expectedDocs:(NSArray<NSString *> *)expectedDocs {
128-
[self checkOnlineAndOfflineCollection:collection
128+
// `checkOnlineAndOfflineCollection` first makes sure all documents needed for
129+
// `query` are in the cache. It does so making a `get` on the first argument.
130+
// Since *all* composite index tests use the same collection, this is very inefficient to do.
131+
// Therefore, we should only do so for tests where `TEST_ID_FIELD` matches the current test.
132+
[self checkOnlineAndOfflineCollection:[self compositeIndexQuery:collection]
129133
query:query
130134
matchesResult:[self toHashedIds:expectedDocs]];
131135
}

Firestore/Example/Tests/Util/FSTIntegrationTestCase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ extern "C" {
130130

131131
- (void)enableNetwork;
132132

133-
- (void)checkOnlineAndOfflineCollection:(FIRCollectionReference *)collection
133+
- (void)checkOnlineAndOfflineCollection:(FIRQuery *)collection
134134
query:(FIRQuery *)query
135135
matchesResult:(NSArray *)expectedDocs;
136136

Firestore/Example/Tests/Util/FSTIntegrationTestCase.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ - (void)enableNetwork {
636636
* @param query The query to check
637637
* @param expectedDocs Ordered list of document keys that are expected to match the query
638638
*/
639-
- (void)checkOnlineAndOfflineCollection:(FIRCollectionReference *)collection
639+
- (void)checkOnlineAndOfflineCollection:(FIRQuery *)collection
640640
query:(FIRQuery *)query
641641
matchesResult:(NSArray *)expectedDocs {
642642
// Note: Order matters. The following has to be done in the specific order:

0 commit comments

Comments
 (0)