This documentation provides a step-by-step guide for running tests within the chainguard-dev/apko
project. The project is structured in Go, with several commands available through the Makefile to facilitate testing and development.
Prerequisites
Ensure that you have the following set up before running tests:
- Go programming language installed (version matching the project’s requirements).
- Make utility to execute Makefile commands.
Running Tests
Clone the Repository
Start by cloning the
chainguard-dev/apko
repository to your local machine:git clone https://github.com/chainguard-dev/apko.git cd apko
Install Dependencies
Before running the tests, make sure all the necessary dependencies are resolved. Use the following command:
make ko-resolve
Clean the Project (Optional)
It is often a good idea to start with a clean state. You can clean the project by running:
make clean
This will remove any previous build files that might interfere with your tests.
Run the Tests
The
Makefile
includes a simple target for running tests. Execute the following command to run the tests:make test
This will invoke the test suite that is defined within the Go files of the project.
Check Code Coverage (Optional)
If you want to assess code coverage while running tests, you can modify the command as follows:
go test -cover ./...
This provides detailed information on the code coverage achieved by your tests.
Run Tests with Linting (Optional)
You can also run tests alongside linting by invoking:
make ci
This command runs the tests while also executing the
golangci-lint
checks.Run Tests with Verbose Output (Optional)
For detailed output during testing, use the
-v
flag:go test -v ./...
This will provide verbose output, showing each test as it runs.
Conclusion
By following the steps outlined above, you should be able to run tests for the chainguard-dev/apko
project effectively. For any advanced configurations or options, refer to the respective sections in the Makefile or Go documentation.
Source: Makefile (direct information from the project)