|
| 1 | +--- |
| 2 | +name: Verify Local Changes |
| 3 | +description: Verifies local Java SDK changes. |
| 4 | +--- |
| 5 | + |
| 6 | +# Verify Local Changes |
| 7 | + |
| 8 | +This skill documents how to verify local code changes for the Java Firestore SDK. This should be run **every time** you complete a fix or feature and are prepared to push a pull request. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +Ensure you have Maven installed and are in the `java-firestore` directory before running commands. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## Step 0: Format the Code |
| 17 | + |
| 18 | +Run the formatter to ensure formatting checks pass: |
| 19 | + |
| 20 | +```bash |
| 21 | +mvn com.spotify.fmt:fmt-maven-plugin:format |
| 22 | +``` |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Step 1: Unit Testing (Isolated then Suite) |
| 27 | + |
| 28 | +1. **Identify modified unit tests** in your changes. |
| 29 | +2. **Run specific units only** to test isolated logic regressions: |
| 30 | + ```bash |
| 31 | + mvn test -Dtest=MyUnitTest#testMethod |
| 32 | + ``` |
| 33 | +3. **Run the entire unit test suite** that contains those modified tests if the isolated unit tests pass: |
| 34 | + ```bash |
| 35 | + mvn test -Dtest=MyUnitTest |
| 36 | + ``` |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Step 2: Integration Testing (Isolated then Suite) |
| 41 | + |
| 42 | +### 💡 Integration Test Nuances (from `ITBaseTest.java`) |
| 43 | + |
| 44 | +When running integration tests, configure your execution using properties or environment variables: |
| 45 | + |
| 46 | +- **`FIRESTORE_EDITION`**: |
| 47 | + - `standard` (Default) |
| 48 | + - `enterprise` |
| 49 | + - *Note*: **Pipelines can only be run against `enterprise` editions**, while standard Queries run on both. |
| 50 | +- **`FIRESTORE_NAMED_DATABASE`**: |
| 51 | + - Enterprise editions usually require a named database (often `enterprise`). Adjust this flag if pointing to specific instances. |
| 52 | +- **`FIRESTORE_TARGET_BACKEND`**: |
| 53 | + - `PROD` (Default) |
| 54 | + - `QA` (points to standard sandboxes) |
| 55 | + - `NIGHTLY` (points to `test-firestore.sandbox.googleapis.com:443`) |
| 56 | + - `EMULATOR` (points to `localhost:8080`) |
| 57 | + |
| 58 | +1. **Identify modified integration tests** (usually Starting in `IT`). |
| 59 | +2. **Run specific integration tests only** (isolated checks run quicker): |
| 60 | + ```bash |
| 61 | + mvn verify -Penable-integration-tests -DFIRESTORE_EDITION=enterprise -DFIRESTORE_NAMED_DATABASE=enterprise -Dtest=ITTest#testMethod -Dclirr.skip=true -Denforcer.skip=true -fae |
| 62 | + ``` |
| 63 | +3. **Run the entire integration test suite** for the modified class if isolation tests pass: |
| 64 | + ```bash |
| 65 | + mvn verify -Penable-integration-tests -DFIRESTORE_EDITION=enterprise -DFIRESTORE_NAMED_DATABASE=enterprise -Dtest=ITTest -Dclirr.skip=true -Denforcer.skip=true -fae |
| 66 | + ``` |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## Step 3: Full Suite Regressions |
| 73 | + |
| 74 | +Run the full integration regression suite once you are confident subsets pass: |
| 75 | + |
| 76 | +```bash |
| 77 | +mvn verify -Penable-integration-tests -DFIRESTORE_EDITION=enterprise -DFIRESTORE_NAMED_DATABASE=enterprise -Dclirr.skip=true -Denforcer.skip=true -fae |
| 78 | +``` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +> [!TIP] |
| 83 | +> Use `-Dclirr.skip=true -Denforcer.skip=true` to speed up iterations where appropriate without leaking compliance checks. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## 🛠️ Troubleshooting & Source of Truth |
| 88 | + |
| 89 | +If you run into issues executing tests with the commands above, **consult the Kokoro configuration files** as the ultimate source of truth: |
| 90 | + |
| 91 | +- **Presubmit configurations**: See `.kokoro/presubmit/integration.cfg` (or `integration-named-db.cfg`) |
| 92 | +- **Nightly configurations**: See `.kokoro/nightly/integration.cfg` |
| 93 | +- **Build shell scripts**: See `.kokoro/build.sh` |
| 94 | + |
| 95 | +These files define the exact environment variables (e.g., specific endpoints or endpoints overrides) the CI server uses! |
0 commit comments