terratest-helm-testing-example
terratest-helm-testing-example copied to clipboard
Example Helm Chart and corresponding test code using terratest.
Helm Chart Testing Example using Terratest
This repository contains the example code from the blog post "Automated Testing for Kubernetes and Helm Charts using Terratest".
The directory structure represents a typical helm chart repository containing various charts in the charts directory
and the tests for those charts under the test directory. The test folder contains the corresponding terratest code
for testing each of the charts in the charts directory.
Quickstart
Prerequisites
To run the tests, you will need a working go install. See here for instructions on installing go on to your platform. Make sure to use a version >=1.13.
Kubernetes cluster
Some of the tests (specifically the integration tests) require a Kubernetes cluster to run. The easiest way to get a
Kuberenetes cluster is to use minikube, which is a local single node
installation of Kubernetes. Follow the instructions in the link to install and setup minikube.
Once minikube is installed, you will also need to install the helm client run the tests based on helm install.
Follow the official guide for instructions on installing helm.
Running the tests
To run the tests, first change directory to the test folder of this repository, and then use go test to run the tests:
cd test
go test -v .