Skip to content

Latest commit

 

History

History

helm-basic-example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Helm Basic Example

This folder contains a minimal helm chart to demonstrate how you can use Terratest to test your helm charts.

There are two kinds of tests you can perform on a helm chart:

  • Helm Template tests are tests designed to test the logic of the templates. These tests should run helm template with various input values and parse the yaml to validate any logic embedded in the templates (e.g by reading them in using client-go). Since templates are not statically typed, the goal of these tests is to promote fast cycle time
  • Helm Integration tests are tests that are designed to deploy the infrastructure and validate that it actually works as expected. If you consider the templates to be syntactic tests, these are semantic tests that validate the behavior of the deployed resources.

The helm chart deploys a single replica Deployment resource given the container image spec and a Service that exposes it. This chart requires the containerImageRepo and containerImageTag input values.

See the corresponding terratest code for an example of how to test this chart:

Running automated tests against this Helm Chart

  1. Install and setup helm
  2. Install Golang and make sure this code is checked out into your GOPATH.
  3. cd test
  4. dep ensure
  5. go test -v -tags helm -run TestHelmBasicExampleTemplate for the template test
  6. go test -v -tags helm -run TestHelmBasicExampleDeployment for the integration test

NOTE: we have build tags to differentiate kubernetes tests from non-kubernetes tests, and further differentiate helm tests. This is done because minikube is heavy and can interfere with docker related tests in terratest. Similarly, helm can overload the minikube system and thus interfere with the other kubernetes tests. Specifically, many of the tests start to fail with connection refused errors from minikube. To avoid overloading the system, we run the kubernetes tests and helm tests separately from the others. This may not be necessary if you have a sufficiently powerful machine. We recommend at least 4 cores and 16GB of RAM if you want to run all the tests together.