World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#850] feat(doc): Rewrite how to test and sign docs (#1050)
Jerry Shaob916b172dfcd
diff --git a/docs/how-to-sign-releases.md b/docs/how-to-sign-releases.mdindex 297de84a6f..d17714eec8 100644--- a/docs/how-to-sign-releases.md+++ b/docs/how-to-sign-releases.md@@ -1,8 +1,7 @@----title: "How to Sign and Verify a Gravitino Releases"-date: 2023-11-01T014:00:00+11:00-license: "Copyright 2023 Datastrato Pvt Ltd.-This software is licensed under the Apache License version 2."+title: How to sign and verify a Gravitino releases+slug: /how-to-sign-release+license: Copyright 2023 Datastrato Pvt. This software is licensed under the Apache License version 2.---These instructions provide a guide on signing and verifying Gravitino releases, enhancing the security of releases. Having a signed release allows people to confirm the release's author and guarantees that the code has not been altered.@@ -16,7 +15,7 @@ Before signing or verifying a Gravitino release, ensure you have the following p## Platform support- These instructions are for OSX, you may need to make adjustments for other platforms.+ These instructions are for macOS, you may need to make adjustments for other platforms.1. **How to Install GPG or GnuPG:**@@ -109,7 +108,9 @@ Before signing or verifying a Gravitino release, ensure you have the following psub cv25519 2023-11-15 [E] [expires: 2028-11-13]```- **IMPORTANT!!!** Ensure to keep your private key secure and saved somewhere other than just your computer. Don't forget your key password, and also securely record it somewhere. If you lose your keys or forget your password you won't be able to sign releases.+:::caution important+Ensure to keep your private key secure and saved somewhere other than just your computer. Don't forget your key password, and also securely record it somewhere. If you lose your keys or forget your password you won't be able to sign releases.+:::2. **Sign a release:**@@ -119,7 +120,7 @@ Before signing or verifying a Gravitino release, ensure you have the following pgpg --detach-sign --armor <filename>.[zip|tar.gz]```- For example to sign the Gravitino 2.0 release you would use this command.+ For example to sign the Gravitino 0.2.0 release you would use this command.```shellgpg --detach-sign --armor gravitino.0.2.0.zip@@ -135,7 +136,7 @@ Before signing or verifying a Gravitino release, ensure you have the following pshasum -a 256 <filename>.[zip|tar.gz] > <filename>.[zip|tar.gz].sha256```- For example, to generate a hash for the Gravitino 2.0 release you would use this command:+ For example, to generate a hash for the Gravitino 0.2.0 release you would use this command:```shellshasum -a 256 gravitino.0.2.0.zip > gravitino.0.2.0.zip.sha256@@ -174,7 +175,7 @@ Before signing or verifying a Gravitino release, ensure you have the following pThe output should contain the text "Good signature from ...".- For example to verify the Gravitino 2.0 zip file you would use this command:+ For example to verify the Gravitino 0.2.0 zip file you would use this command:```shellgpg --verify gravitino.0.2.0.zip.ascdiff --git a/docs/how-to-test.md b/docs/how-to-test.mdnew file mode 100644index 0000000000..4f83c3f4d6--- /dev/null+++ b/docs/how-to-test.md@@ -0,0 +1,164 @@+---+title: How to test Gravitino+slug: /how-to-test+license: Copyright 2023 Datastrato Pvt. This software is licensed under the Apache License version 2.+---++Gravitino has two types of tests: unit tests and integration tests. Unit tests are mainly+focused on the functionalities of the specific class, module, or component. Integration tests+are end-to-end tests that covers the whole system.++:::note before test+* If you want to run the complete integration test suites, you need to install Docker in your+ environment.+* Please refer to [How to build Gravitino](./how-to-build) for more details to make sure you have+ a build environment ready.+* [OrbStack](https://orbstack.dev/) is highly recommended to replace Docker Desktop for+ macOS. OrbStack automatically configures the network between Docker containers.+* If you insist on using Docker Desktop for macOS, please launch+ [mac-docker-connector](https://github.com/wenjunxiao/mac-docker-connector) before running tests,+ you can read `$GRAVITINO_HOME/dev/docker/tools/README.md` and+ `$GRAVITINO_HOME/dev/docker/tools/mac-docker-connector.sh` for more details.+:::++## Run the unit tests++To run the unit test, you can simply run the following command:++```shell++./gradlew test -PskipITs+```++This command runs all the unit tests and skip the integration tests.++## Run the integration tests++Gravitino has two modes to run the integration tests, the `embedded` and `deploy` modes.++* With the `embedded` mode, the integration test starts an embedded `MiniGravitino` server+ within the same process of the integration test to run the integration tests.+* With the `deploy` mode, the user has to deploy a Gravitino binary package beforehand, the+ integration test launches and connects to the local Gravitino server to run the integration+ tests.++### Run the integration tests in embedded mode++1. Run the `./gradlew build -x test` command to build the Gravitino project.++2. Use the `./gradlew test [--rerun-tasks] -PskipTests -PtestMode=embedded` commands to run the+ integration tests.++:::note+Running the `./gradlew build` command triggers the build and run the integration tests in embedded+mode.+:::++### Deploy the Gravitino server and run the integration tests in deploy mode++Deploy the Gravitino server locally to run the integration tests. Follow these steps:++1. Run the `./gradlew build -x test` command to build the Gravitino project.+2. Use the `./gradlew compileDistribution` command to compile and package the Gravitino project+ in the `distribution` directory.+3. Use the `./gradlew test [--rerun-tasks] -PskipTests -PtestMode=deploy` command to run the+ integration tests in the `distribution` directory.++## Skip tests++- You can skip unit tests by using the `./gradlew build -PskipTests` command.+- You can skip integration tests by using the `./gradlew build -PskipITs` command.+- You can skip both unit tests and integration tests by using the `./gradlew build -x test` or `./gradlew build -PskipTests -PskipITs` commands.++## Docker test environment++Some integration test cases depend on the Gravitino CI Docker image.++If an integration test relies on the specific Gravitino CI Docker image,+you need to set the `@tag(gravitino-docker-it)` annotation in the test class.+For example, the `integration-test/src/test/.../CatalogHiveIT.java` test needs to connect to+the `datastrato/gravitino-ci-hive` Docker container for testing the Hive data source.+Therefore, it should have the following `@tag` annotation:`@tag(gravitino-docker-it)`, This annotation+helps identify the specific Docker container required for the integration test.+For example:++```java+@Tag("gravitino-docker-it")+public class CatalogHiveIT extends AbstractIT {+...+}+```++## Running all the integration tests++:::note+* You should make sure that the `Docker server` is running before running all the+ integration tests. Otherwise, it only runs the integration tests without the `gravitino-docker-it` tag.+* on macOS, please be sure to run the `${GRAVITION_HOME}/dev/docker/tools/mac-docker-connector.sh`+ script before running the integration tests. Or, you should make sure that+ [OrbStack](https://orbstack.dev/) is running.+:::++When integration tests run, it checks the whole environment and outputs the status of the+required environment, for example:++```text+------------------ Check Docker environment ---------------------+Docker server status ............................................ [running]+mac-docker-connector status ..................................... [stop]+OrbStack status ................................................. [yes]+Using Gravitino IT Docker container to run all integration tests. [deploy test]+-----------------------------------------------------------------+```++Only when all the required environments are ready, all the integration tests run, otherwise,+only parts of the integration tests without `gravitino-docker-it` tag run.++## How to debug Gravitino server and integration tests in embedded mode++By default, the integration tests runs in the embedded mode, `MiniGravitino` starts in the+same process. Debugging `MiniGravitino` is simple and easy. You can modify any code in the+Gravitino project and set breakpoints anywhere.++## How to debug Gravitino server and integration tests in deploy mode++This mode is closer to the actual environment but more complex to debug. To debug the Gravitino+server code, follow these steps:++- Run the `./gradlew build -x test` command to build the Gravitino project.+- Use the `./gradlew compileDistribution` command to republish the packaged project in the `distribution` directory.+- If you only debug integration test codes, You don't have to do any setup to debug directly.+- If you need to debug Gravitino server codes, follow these steps:+ - Enable the `GRAVITINO_DEBUG_OPTS` environment variable in the+ `distribution/package/conf/gravitino-env.sh` file to enable remote JVM debugging.+ - Manually start the Gravitino server using the `./distribution/package/bin/gravitino.sh+ start` command.+ - Select `gravitino.server.main` module classpath in the `Remote JVM Debug` to attach the+ Gravitino server process and debug it.++## Running on GitHub actions++- GitHub Actions automatically run integration tests in the embedded and deploy mode when you+ submit a pull request.+- View the test results in the `Actions` tab of the pull request page.+- Run the integration tests in several steps:+ - The Gravitino integration tests pull the CI Docker image from the Docker Hub repository. This step typically takes around 15 seconds.+ - If you set the `debug action` label in the pull request, GitHub actions runs an SSH server with `csexton/debugger-action@master`, allowing you to log in to the actions environment for remote debugging.+ - The Gravitino project compiles and packages in the `distribution` directory using the `./gradlew compileDistribution` command.+ - Run the `./gradlew test -PtestMode=[embedded|deploy]` command.++## Test failure++If a test fails, you can retrieve valuable information from the logs and test report. Test reports are in the `./build/reports` directory. The integration test logs are in the `./integrate-test/build` directory. In deploy mode, Gravitino server logs are in the `./distribution/package/logs/` directory. In the event of a test failure within the GitHub workflow, the system generates archived logs and test reports. To obtain the archive, follow these steps:++1. Click the `detail` link associated with the failed integrate test in the pull request. This redirects you to the job page.++ ++2. On the job page, locate the `Summary` button on the left-hand side and click it to access the workflow summary page.++ ++3. Look for the Artifacts item on the summary page and download the archive from there.++ \ No newline at end of filediff --git a/docs/integration-test.md b/docs/integration-test.mddeleted file mode 100644index 11a799492c..0000000000--- a/docs/integration-test.md+++ /dev/null@@ -1,140 +0,0 @@-----title: "How to Run Integration Tests"-date: 2023-10-02T09:03:20-08:00-license: "Copyright 2023 Datastrato Pvt Ltd.-This software is licensed under the Apache License version 2."-----## How to run integration tests--## Introduction--The `integration-test` module contains integration test cases to ensure the correctness of the-Gravitino server, API, and client. You can run these tests locally or on GitHub Actions.--## Test modes--### Running MiniGravitino in embedded mode--The `MiniGravitino` is a lightweight Gravitino server embedded in the integration test module.--1. Run the `./gradlew build -x test` command to build the Gravitino project.--2. Use the `./gradlew test [--rerun-tasks]` or `./gradlew test [--rerun-tasks] -PtestMode=embedded` commands to run the integration tests.--> Run the `./gradlew build` command to build the Gravitino project and run the integration tests in embedded mode.--The Gravitino server supports the following abilities:--- Running a Gravitino server in a single thread.-- Starting a Jetty server to provide the Gravitino server API, using a random port to avoid port conflicts.-- Using a random storage path to store backend data. Stopping MiniGravitino deletes the backend data.--### Deploying the Gravitino server locally--Deploy the Gravitino server locally to run the integration tests. Follow these steps:--1. Run the `./gradlew build -x test` command to build the Gravitino project.-2. Use the `./gradlew compileDistribution` command to compile and package the Gravitino project in the `distribution` directory.-3. Use the `./gradlew test [--rerun-tasks] -PtestMode=deploy` command to run the integration tests in the `distribution` directory.--### Skipping tests--- You can skip unit tests by using the `./gradlew build -PskipTests` command.-- You can skip integration tests by using the `./gradlew build -PskipITs` command.-- You can skip both unit tests and integration tests by using the `./gradlew build -x test` or `./gradlew build -PskipTests -PskipITs` commands.--## Docker test environment--Some integration test cases depend on the Gravitino CI Docker environment.--If an integration test relies on the specific Gravitino CI Docker environment,-you need to set the `@tag(gravitino-docker-it)` annotation in the test class.-For example, the `integration-test/src/test/.../CatalogHiveIT.java` test needs to connect to-the `datastrato/gravitino-ci-hive` Docker container for testing the Hive data source.-Therefore, it should have the following `@tag` annotation:`@tag(gravitino-docker-it)`, This annotation-helps identify the specific Docker container required for the integration test.-For example:--```java-@Tag("gravitino-docker-it")-public class CatalogHiveIT extends AbstractIT {-...-}-```--### Running all integration tests--If you're running `Docker server` and `mac-docker-connector` (only macOS needs to run `mac-docker-connector`), the `./gradlew test -PtestMode=[embedded|deploy]`-command runs all the test cases.--```text-------------------- Check Docker environment ---------------------Docker server status ............................................ [running]-mac-docker-connector server status .............................. [running]-Using Gravitino IT Docker container to run all integration tests. [embedded test]-------------------------------------------------------------------```--### Docker server or mac-docker-connector not running--Running the ./gradlew test -PtestMode=[embedded|deploy] command runs all test cases without the `gravitino-docker-it` tag, when the `Docker server` or `mac-docker-connector` (only required in MacOS) isn't running.--```text-------------------- Check Docker environment -------------------Docker server status ............................................ [stop]-mac-docker-connector server status .............................. [stop]-Run test cases without `gravitino-docker-it` tag ................ [embedded test]-----------------------------------------------------------------Tip: Please make sure to start the `Docker server` before running the integration tests.-Tip: Please make sure to run the `dev/docker/tools/mac-docker-connector.sh` script before running the integration tests in MacOS.-```--## Debugging Gravitino server and integration tests--By default, using MiniGravitino runs the integration tests. Debugging with MiniGravitino is simple and easy. You can modify any code in the Gravitino project and set breakpoints anywhere.--### How to debug deploy mode Gravitino server and integration tests--You have two modes to debug the Gravitino server and integration tests, the `embedded` and `deploy` modes.--1. Embedded Mode is the default:- - This mode is simpler to debug but not as close to the actual environment.- - Debugging with `MiniGravitino` is simple and easy. You don't have to do any setup to debug directly.--2. Deploy Mode:- - This mode is closer to the actual environment but more complex to debug.- - To debug the Gravitino server code, follow these steps:- - Run the `./gradlew build -x test` command to build the Gravitino project.- - Use the `./gradlew compileDistribution` command to republish the packaged project in the `distribution` directory.- - If you only debug integration test codes, You don't have to do any setup to debug directly.- - If you need to debug Gravitino server codes, follow these steps:- - Enable the `GRAVITINO_DEBUG_OPTS` environment variable in the `distribution/package/conf/gravitino-env.sh` file to enable remote JVM debugging.- - Manually start the Gravitino server using the `./distribution/package/bin/gravitino.sh start` command.- - Select `gravitino.server.main` module classpath in the `Remote JVM Debug` to attach the Gravitino server process and debug it.--## Running on GitHub actions--- GitHub Actions automatically run integration tests in the embedded and deploy mode when you submit a pull request to the 'main' branch.-- View the test results in the `Actions` tab of the pull request page.-- Run the integration tests in several steps:-- - The Gravitino integration tests pull the CI Docker image from the Docker Hub repository. This step typically takes around 15 seconds.- - If you set the `debug action` label in the pull request, GitHub actions runs an SSH server with `csexton/debugger-action@master`, allowing you to log in to the actions environment for remote debugging.- - The Gravitino project compiles and packages in the `distribution` directory using the `./gradlew compileDistribution` command.- - Run the `./gradlew test -PtestMode=[embedded|deploy]` command.--## Test failure--If a test fails, you can retrieve valuable information from the logs and test report. Test reports are in the `./build/reports` directory. The integration test logs are in the `./integrate-test/build` directory. In deploy mode, Gravitino server logs are in the `./distribution/package/logs/` directory. In the event of a test failure within the GitHub workflow, the system generates archived logs and test reports. To obtain the archive, follow these steps:--1. Click the `detail` link associated with the failed integrate test in the pull request. This redirects you to the job page.-- --2. On the job page, locate the `Summary` button on the left-hand side and click it to access the workflow summary page.-- --3. Look for the Artifacts item on the summary page and download the archive from there.-- 