How to test Apache Gravitino
Apache Gravitino has two types of tests:
- Unit tests, focus on the functionalities of the specific class, module, or component.
- Integration tests, end-to-end tests that cover the whole system.
before test
- If you want to run the complete integration test suites, you need to install Docker in your environment.
- Refer to How to build Gravitino to make sure you have a build environment ready.
- You can use OrbStack to replace Docker Desktop on macOS. OrbStack automatically configures the network between the Docker containers.
- If you are using Docker Desktop for macOS, launch the
mac-docker-connector before running the tests.
Read
$GRAVITINO_HOME/dev/docker/tools/README.mdand$GRAVITINO_HOME/dev/docker/tools/mac-docker-connector.shfor more details.
Run the unit tests
To run the unit tests, run the following command:
./gradlew test -PskipITs
This command runs all the unit tests and skips the integration tests.
Run the integration tests
Gravitino has two modes to run the integration tests, the default embedded mode and deploy mode.
- In
embeddedmode, the integration test starts an embeddedMiniGravitinoserver within the same process as the integration test to run the integration tests. - In
deploymode, you have to build (./gradlew compileDistribution) 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
-
Run the
./gradlew build -x testcommand to build the Gravitino project. -
Use the
./gradlew test [--rerun-tasks] -PskipTests -PtestMode=embeddedcommands to run the integration tests.
note
Running the ./gradlew build command triggers the build and runs the integration tests in embedded mode.