Running Tests for Stefanprodan/Timoni
This guide provides a step-by-step process for running tests for the Stefanprodan/Timoni project.
Prerequisites
- Go 1.18+: Ensure you have Go installed and configured. https://go.dev/doc/install
- Docker: Docker is required for running the integration tests. https://docs.docker.com/get-docker/
Running Tests
The project utilizes make
to automate the testing process. Here’s how to run different types of tests:
1. Running Unit Tests:
make test
This command will execute all unit tests within the project.
2. Running Integration Tests:
make envtest
This command will:
- Build the project using the
envtest
profile, which includes the necessary dependencies for integration testing. - Run the integration tests.
3. Running CUE Tests:
make cue-vet
This command will execute CUE validation tests.
4. Running Code Linting:
make vet
This command runs Go vet to identify potential code issues.
5. Running All Tests:
make all
This command will execute all the tests mentioned above.
Understanding the Makefile
The Makefile
defines various targets for running different tasks, including testing:
test
: Executes unit tests.envtest
: Builds the project using theenvtest
profile and runs integration tests.cue-vet
: Executes CUE validation tests.vet
: Runs Go vet for code linting.all
: Runs all tests.
Note: The Makefile provides more detailed information on other available targets. Run make help
to display the full list of available functions.