|
1 | 1 | ## Summary |
2 | 2 |
|
3 | | -This project runs cross-version server/schema integration tests with arbitrary |
4 | | -version pairs. It may be used by presubmit tests and continuous-integration |
5 | | -tests, or as a gating test during release and/or deployment. |
| 3 | +This subproject provides two integration tests that ensure schema safety: |
6 | 4 |
|
7 | | -## Maven Dependencies |
| 5 | +* One test checks for edits to Flyway scripts already deployed to Sandbox |
| 6 | + Production. Such edits will cause schema deployment failure. |
| 7 | +* Another test runs cross-version server/schema integration tests between a |
| 8 | + pull request and the deployed release in Sandbox or Production. If a pull |
| 9 | + request fails this test, it either contains schema changes not compatible |
| 10 | + with Sandbox/Production binaries, or binaries not compatible with the |
| 11 | + current schema in Sandbox/Production. This test may be include in presubmit |
| 12 | + testing. |
8 | 13 |
|
9 | | -This release process is expected to publish the following Maven dependencies to |
10 | | -a well-known repository: |
| 14 | +## Test Artifacts |
11 | 15 |
|
12 | | -* google.registry:schema, which contains the schema DDL scripts. This is done |
13 | | - by the ':db:publish' task. |
14 | | -* google.registry:nomulus_test, which contains the nomulus classes and |
15 | | - dependencies needed for the integration tests. This is done by the |
16 | | - ':core:publish' task. |
| 16 | +To support the tests above, each release generates the following test artifacts: |
17 | 17 |
|
18 | | -After each deployment in sandbox or production, the deployment process is |
19 | | -expected to save the version tag of the binary or schema along with the |
20 | | -environment. These tags will be made available to test runners. |
| 18 | +* schema.jar: The flyway scripts. |
| 19 | +* nomulus-public.jar: The open-source java classes. |
| 20 | +* nomulus-tests-alldeps.jar: Uber jar with schema test classes and all |
| 21 | + third-party dependencies. |
21 | 22 |
|
22 | | -## Usage |
| 23 | +After each deployment in sandbox or production, the deployment process copies |
| 24 | +these artifacts to a well-known location, and appends the environment tag to |
| 25 | +the file names. |
23 | 26 |
|
24 | | -The ':integration:sqlIntegrationTest' task is the test runner. It uses the |
25 | | -following properties: |
| 27 | +## Usage |
26 | 28 |
|
27 | | -* nomulus_version: a Registry server release tag, or 'local' if the code in |
28 | | - the local Git tree should be used. |
29 | | -* schema_version: a schema release tag, or 'local' if the code in the local |
30 | | - Git tree should be used. |
31 | | -* publish_repo: the Maven repository where release jars may be found. This is |
32 | | - required if neither of the above is 'local'. |
| 29 | +Use the convenience scripts in the `integration` folder to run the tests. |
33 | 30 |
|
34 | | -Given a program 'fetch_version_tag' that retrieves the currently deployed |
35 | | -version tag of SQL schema or server binary in a particular environment (which as |
36 | | -mentioned earlier are saved by the deployment process), the following code |
37 | | -snippet checks if the current PR or local clone has schema changes, and if yes, |
38 | | -tests the production server's version with the new schema. |
| 31 | +```bash |
| 32 | +./integration/run_schema_check.sh -p domain-registry-dev |
39 | 33 |
|
40 | | -```shell |
41 | | -current_prod_schema=$(fetch_version_tag schema production) |
42 | | -current_prod_server=$(fetch_version_tag server production) |
43 | | -schema_changes=$(git diff ${current_prod_schema} --name-only \ |
44 | | - ./db/src/main/resources/sql/flyway/ | wc -l) |
45 | | -[[ schema_changes -gt 0 ]] && ./gradlew :integration:sqlIntegrationTest \ |
46 | | - -Ppublish_repo=${REPO} -Pschema_version=local \ |
47 | | - -Pnomulus_version=current_prod_server |
| 34 | +./integration/run_compatibility_tests.sh -p domain-registry-dev -s sql |
| 35 | +./integration/run_compatibility_tests.sh -p domain-registry-dev -s nomulus |
48 | 36 | ``` |
49 | 37 |
|
50 | 38 | ## Implementation Notes |
|
0 commit comments