Skip to content

Commit

Permalink
Add MIEQ negative test cases (#11934)
Browse files Browse the repository at this point in the history
  • Loading branch information
milaGGL authored Oct 23, 2023
1 parent ea1886a commit 8d66bdc
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/firestore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:

- name: Build and test
run: |
export EXPERIMENTAL_MODE=true
export CCACHE_DIR=${{ runner.temp }}/ccache
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
Expand Down Expand Up @@ -256,6 +257,7 @@ jobs:

- name: Build and test
run: |
export EXPERIMENTAL_MODE=true
export CCACHE_DIR=${{ runner.temp }}/ccache
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ runner.os }} cmake
Expand Down Expand Up @@ -284,7 +286,9 @@ jobs:
run: scripts/install_prereqs.sh Firestore ${{ matrix.target }} xcodebuild

- name: Build and test
run: scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ matrix.target }} xcodebuild
run: |
export EXPERIMENTAL_MODE=true
scripts/third_party/travis/retry.sh scripts/build.sh Firestore ${{ matrix.target }} xcodebuild
pod-lib-lint:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/health-metrics-presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ jobs:
- name: Setup Bundler
run: scripts/setup_bundler.sh
- name: Build and test
run: ./scripts/health_metrics/pod_test_code_coverage_report.sh --sdk=FirebaseFirestore --platform=${{ matrix.target }}
run: |
export EXPERIMENTAL_MODE=true
./scripts/health_metrics/pod_test_code_coverage_report.sh --sdk=FirebaseFirestore --platform=${{ matrix.target }}
- uses: actions/upload-artifact@v2
with:
name: codecoverage
Expand Down
44 changes: 44 additions & 0 deletions Firestore/Example/Tests/Integration/API/FIRQueryTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ - (void)testMultipleInequalityOnSpecialValues {
isLessThanOrEqualTo:@1]];
XCTAssertEqualObjects(FIRQuerySnapshotGetIDs(snapshot), (@[ @"doc6" ]));
}

- (void)testMultipleInequalityWithArrayMembership {
// TODO(MIEQ): Enable this test against production when possible.
XCTSkipIf(![FSTIntegrationTestCase isRunningAgainstEmulator],
Expand Down Expand Up @@ -1567,6 +1568,49 @@ - (void)testMultipleInequalityFromCacheAndFromServer {
matchesResult:@[ @"doc1", @"doc3" ]];
}

- (void)testMultipleInequalityRejectsIfDocumentKeyIsNotTheLastOrderByField {
// TODO(MIEQ): Enable this test against production when possible.
XCTSkipIf(![FSTIntegrationTestCase isRunningAgainstEmulator],
"Skip this test if running against production because multiple inequality is "
"not supported yet.");

FIRCollectionReference *collRef = [self collectionRef];

FIRQuery *query = [[collRef queryWhereField:@"key" isNotEqualTo:@42]
queryOrderedByFieldPath:[FIRFieldPath documentID]];

XCTestExpectation *queryCompletion = [self expectationWithDescription:@"query"];
[query getDocumentsWithCompletion:^(FIRQuerySnapshot *results, NSError *error) {
XCTAssertNil(results);
XCTAssertNotNil(error);
XCTAssertEqual(error.code, FIRFirestoreErrorCodeInvalidArgument);
[queryCompletion fulfill];
}];
[self awaitExpectations];
}

- (void)testMultipleInequalityRejectsIfDocumentKeyAppearsOnlyInEqualityFilter {
// TODO(MIEQ): Enable this test against production when possible.
XCTSkipIf(![FSTIntegrationTestCase isRunningAgainstEmulator],
"Skip this test if running against production because multiple inequality is "
"not supported yet.");

FIRCollectionReference *collRef = [self collectionRef];

FIRQuery *query = [[collRef queryWhereField:@"key"
isNotEqualTo:@42] queryWhereFieldPath:[FIRFieldPath documentID]
isEqualTo:@"doc1"];

XCTestExpectation *queryCompletion = [self expectationWithDescription:@"query"];
[query getDocumentsWithCompletion:^(FIRQuerySnapshot *results, NSError *error) {
XCTAssertNil(results);
XCTAssertNotNil(error);
XCTAssertEqual(error.code, FIRFirestoreErrorCodeInvalidArgument);
[queryCompletion fulfill];
}];
[self awaitExpectations];
}

- (void)testResumingAQueryShouldUseBloomFilterToAvoidFullRequery {
// TODO(b/291365820): Stop skipping this test when running against the Firestore emulator once
// the emulator is improved to include a bloom filter in the existence filter messages that it
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_firestore_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [[ ! -z "${JAVA_HOME_11_X64:-}" ]]; then
export JAVA_HOME=$JAVA_HOME_11_X64
fi

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

Expand Down

0 comments on commit 8d66bdc

Please sign in to comment.