Skip to content

heyvister/terratest-helm-testing-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 deploy Tiller to run the tests based on helm install. To deploy Tiller, you will first need to install the helm client. Follow the official guide for instructions on installing helm.

Once helm is installed, you can setup Tiller on minikube using helm init:

helm init --wait

To verify Tiller deployed correctly, use helm version. If the deploy was successful, you should see both the client and server versions:

$ helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}

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 .

Releases

No releases published

Packages

No packages published

Languages

  • Go 84.3%
  • Smarty 15.7%