How do I run tests for the project?
This document provides a step-by-step guide on running tests for the project.
Running Tests
The project’s test suite can be executed using the make
command. There are various options available for running specific tests.
Run all tests:
make test
This command will execute all the tests for the project.
Run integration tests:
make integration
This command will execute the integration tests for the project.
Run cloud storage driver tests:
make test-cloud-storage
This command will execute the tests for the cloud storage driver. It includes the following steps:
- Start the local cloud storage (Minio) using
make start-cloud-storage
. - Run the S3 tests using
make run-s3-tests
. - Stop the local cloud storage using
make stop-cloud-storage
.
Run race detector tests:
make test-race
This command will execute the tests with the race detector enabled.
Run tests with coverage:
make test-coverage
This command will execute the tests with coverage analysis enabled. The results will be saved in the coverage.txt
file.
Makefile Features
The project uses a Makefile
to simplify the test execution process. It provides various functions to streamline testing:
help
: Displays available targets and their descriptions.test
: Runs all tests.integration
: Runs integration tests.test-cloud-storage
: Runs cloud storage driver tests.start-cloud-storage
: Starts the local cloud storage (Minio).stop-cloud-storage
: Stops the local cloud storage.test-race
: Runs tests with the race detector enabled.test-coverage
: Runs tests with coverage analysis enabled.
The Makefile
also defines the following default targets:
.DEFAULT_GOAL: help
: Sets the default target to be executed when no target is specified..DEFAULT: all
: Provides a fallback rule for when a specified target does not exist.
Additional Notes
- Tests can be run with specific flags for more control. Refer to the Go testing documentation for details.
- The
tests/push.sh
script can be used to push a Docker image to the local registry. - The
registry/storage/driver/testsuites/testsuites.go
file provides a framework for running tests for different storage drivers.
Please note: This documentation assumes you have a basic understanding of the project and its dependencies. If you need further assistance, consult the project’s documentation or community resources.