Skip to content

Commit 8d66bdc

Browse files
authored
Add MIEQ negative test cases (#11934)
1 parent ea1886a commit 8d66bdc

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed

.github/workflows/firestore.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ jobs:
135135

136136
- name: Build and test
137137
run: |
138+
export EXPERIMENTAL_MODE=true
138139
export CCACHE_DIR=${{ runner.temp }}/ccache
139140
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
140141
@@ -256,6 +257,7 @@ jobs:
256257

257258
- name: Build and test
258259
run: |
260+
export EXPERIMENTAL_MODE=true
259261
export CCACHE_DIR=${{ runner.temp }}/ccache
260262
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
261263
@@ -284,7 +286,9 @@ jobs:
284286
run: scripts/install_prereqs.sh Firestore ${{ matrix.target }} xcodebuild
285287

286288
- name: Build and test
287-
run: scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ matrix.target }} xcodebuild
289+
run: |
290+
export EXPERIMENTAL_MODE=true
291+
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ matrix.target }} xcodebuild
288292
289293
290294
pod-lib-lint:

.github/workflows/health-metrics-presubmit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@ jobs:
209209
- name: Setup Bundler
210210
run: scripts/setup_bundler.sh
211211
- name: Build and test
212-
run: ./scripts/health_metrics/pod_test_code_coverage_report.sh --sdk=FirebaseFirestore --platform=${{ matrix.target }}
212+
run: |
213+
export EXPERIMENTAL_MODE=true
214+
./scripts/health_metrics/pod_test_code_coverage_report.sh --sdk=FirebaseFirestore --platform=${{ matrix.target }}
213215
- uses: actions/upload-artifact@v2
214216
with:
215217
name: codecoverage

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ - (void)testMultipleInequalityOnSpecialValues {
11591159
isLessThanOrEqualTo:@1]];
11601160
XCTAssertEqualObjects(FIRQuerySnapshotGetIDs(snapshot), (@[ @"doc6" ]));
11611161
}
1162+
11621163
- (void)testMultipleInequalityWithArrayMembership {
11631164
// TODO(MIEQ): Enable this test against production when possible.
11641165
XCTSkipIf(![FSTIntegrationTestCase isRunningAgainstEmulator],
@@ -1567,6 +1568,49 @@ - (void)testMultipleInequalityFromCacheAndFromServer {
15671568
matchesResult:@[ @"doc1", @"doc3" ]];
15681569
}
15691570

1571+
- (void)testMultipleInequalityRejectsIfDocumentKeyIsNotTheLastOrderByField {
1572+
// TODO(MIEQ): Enable this test against production when possible.
1573+
XCTSkipIf(![FSTIntegrationTestCase isRunningAgainstEmulator],
1574+
"Skip this test if running against production because multiple inequality is "
1575+
"not supported yet.");
1576+
1577+
FIRCollectionReference *collRef = [self collectionRef];
1578+
1579+
FIRQuery *query = [[collRef queryWhereField:@"key" isNotEqualTo:@42]
1580+
queryOrderedByFieldPath:[FIRFieldPath documentID]];
1581+
1582+
XCTestExpectation *queryCompletion = [self expectationWithDescription:@"query"];
1583+
[query getDocumentsWithCompletion:^(FIRQuerySnapshot *results, NSError *error) {
1584+
XCTAssertNil(results);
1585+
XCTAssertNotNil(error);
1586+
XCTAssertEqual(error.code, FIRFirestoreErrorCodeInvalidArgument);
1587+
[queryCompletion fulfill];
1588+
}];
1589+
[self awaitExpectations];
1590+
}
1591+
1592+
- (void)testMultipleInequalityRejectsIfDocumentKeyAppearsOnlyInEqualityFilter {
1593+
// TODO(MIEQ): Enable this test against production when possible.
1594+
XCTSkipIf(![FSTIntegrationTestCase isRunningAgainstEmulator],
1595+
"Skip this test if running against production because multiple inequality is "
1596+
"not supported yet.");
1597+
1598+
FIRCollectionReference *collRef = [self collectionRef];
1599+
1600+
FIRQuery *query = [[collRef queryWhereField:@"key"
1601+
isNotEqualTo:@42] queryWhereFieldPath:[FIRFieldPath documentID]
1602+
isEqualTo:@"doc1"];
1603+
1604+
XCTestExpectation *queryCompletion = [self expectationWithDescription:@"query"];
1605+
[query getDocumentsWithCompletion:^(FIRQuerySnapshot *results, NSError *error) {
1606+
XCTAssertNil(results);
1607+
XCTAssertNotNil(error);
1608+
XCTAssertEqual(error.code, FIRFirestoreErrorCodeInvalidArgument);
1609+
[queryCompletion fulfill];
1610+
}];
1611+
[self awaitExpectations];
1612+
}
1613+
15701614
- (void)testResumingAQueryShouldUseBloomFilterToAvoidFullRequery {
15711615
// TODO(b/291365820): Stop skipping this test when running against the Firestore emulator once
15721616
// the emulator is improved to include a bloom filter in the existence filter messages that it

scripts/run_firestore_emulator.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if [[ ! -z "${JAVA_HOME_11_X64:-}" ]]; then
2525
export JAVA_HOME=$JAVA_HOME_11_X64
2626
fi
2727

28-
VERSION='1.17.4'
28+
VERSION='1.18.2'
2929
FILENAME="cloud-firestore-emulator-v${VERSION}.jar"
3030
URL="https://storage.googleapis.com/firebase-preview-drop/emulator/${FILENAME}"
3131

0 commit comments

Comments
 (0)