Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add composite index testing guidance to ReadMe #5421

Merged
merged 33 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
66c94f8
add guidance to readme, silence the terraform index exists error
milaGGL Oct 13, 2023
7368d40
Merge branch 'master' into mila/add-composite-index-testing-guide
milaGGL Oct 13, 2023
cd1a500
Update README.md
milaGGL Oct 16, 2023
c3d7f8e
Update ci_tests.yml
milaGGL Oct 16, 2023
f055dee
Update ci_tests.yml
milaGGL Oct 16, 2023
7a1eabf
Update ci_tests.yml
milaGGL Oct 16, 2023
5853920
Update ci_tests.yml
milaGGL Oct 16, 2023
feb14e6
Update ci_tests.yml
milaGGL Oct 16, 2023
e580b40
Update ci_tests.yml
milaGGL Oct 16, 2023
03f70ab
Update ci_tests.yml
milaGGL Oct 16, 2023
a92ada9
Update ci_tests.yml
milaGGL Oct 17, 2023
4650ab8
Update ci_tests.yml
milaGGL Oct 17, 2023
562df93
Update ci_tests.yml
milaGGL Oct 17, 2023
8d3076e
Update ci_tests.yml
milaGGL Oct 17, 2023
a9bdf3c
make the message bold
milaGGL Oct 17, 2023
121ebc2
Update ci_tests.yml
milaGGL Oct 17, 2023
c8884ae
Update ci_tests.yml
milaGGL Oct 17, 2023
fa69bb5
Update ci_tests.yml
milaGGL Oct 17, 2023
ad260e8
Merge branch 'master' into mila/add-composite-index-testing-guide
milaGGL Oct 17, 2023
20b071e
Update ci_tests.yml
milaGGL Oct 17, 2023
8a4e81e
Merge branch 'mila/add-composite-index-testing-guide' of https://gith…
milaGGL Oct 17, 2023
acb8557
Update ci_tests.yml
milaGGL Oct 17, 2023
47506d1
Update ci_tests.yml
milaGGL Oct 17, 2023
e66ffd0
Update ci_tests.yml
milaGGL Oct 17, 2023
3917bd4
Update ci_tests.yml
milaGGL Oct 17, 2023
7cb2a12
Update ci_tests.yml
milaGGL Oct 17, 2023
b90972c
Update ci_tests.yml
milaGGL Oct 17, 2023
fea8222
Update ci_tests.yml
milaGGL Oct 17, 2023
adf3227
Update ci_tests.yml
milaGGL Oct 17, 2023
1d56cc8
Merge branch 'master' into mila/add-composite-index-testing-guide
milaGGL Oct 17, 2023
e32ff8d
Update ci_tests.yml
milaGGL Oct 18, 2023
22d8747
Update ci_tests.yml
milaGGL Oct 18, 2023
facefcb
Update ci_tests.yml
milaGGL Oct 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
if: github.event_name == 'pull_request' && contains(matrix.module, ':firebase-firestore')
run: |
cd firebase-firestore
terraform apply -var-file=../google-services.json -auto-approve
terraform apply -var-file=../google-services.json -auto-approve &> /dev/null
ehsannas marked this conversation as resolved.
Show resolved Hide resolved
continue-on-error: true
- name: ${{ matrix.module }} Integ Tests
env:
Expand Down
24 changes: 24 additions & 0 deletions firebase-firestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,30 @@ Run:
./gradlew :firebase-firestore:deviceCheck
```

### Testing composite index query against production
#### Setting Up the Environment:
1. Navigate to the `firebase-android-sdk/firebase-firestore` directory.
2. Create a `google-services.json` file. This file should contain your target Firebase project's
configuration.
2. If not already logged in, authenticate with your Google Cloud Platform (GCP) account using
`gcloud auth application-default login`. You can check your logged-in accounts by running
`gcloud auth list`.
3. Create composite indexes by running:
```
terraform init
terraform apply -var-file=../google-services.json -auto-approve
```
Note: If the index creation encounters issues, such as concurrent operations, consider running the
index creation process again. Error messages indicating that indexes have already been created can
be safely disregarded.

#### Adding new composite index query tests
1. To create a new composite index for local development, click on the provided link in the test
error message, which will direct you to the Firebase Console.
2. Add the newly created composite index to the `firestore_index_config.tf` file. The "__name__"
field is not required to be explicitly added to the file, as the index creation will auto complete
it on behalf.

## Code Formatting

Run below to format Java code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@
* Guidance for Creating Tests:
* ----------------------------
* When creating tests that require composite indexes, it is recommended to utilize the
* "CompositeIndexTestHelper" class. This utility class provides methods for creating
* and setting test documents and running queries with ease, ensuring proper data
* isolation and query construction.
* "CompositeIndexTestHelper" class. This utility class provides methods for creating and setting
* test documents and running queries with ease, ensuring proper data isolation and query
* construction.
*
* Please remember to update the main index configuration file (firestore_index_config.tf)
* with any new composite indexes needed for the tests. This ensures synchronization with
* other testing environments, including CI. You can generate the required index link by
* clicking on the Firebase console link in the error message while running tests locally.
* To get started, please refer to the instructions provided in the README file. This will guide
* you through setting up your local testing environment and updating the Terraform configuration
* with any new composite indexes required for your testing scenarios.
*/
@RunWith(AndroidJUnit4.class)
public class CompositeIndexQueryTest {
Expand Down
Loading