github.com/swisspost/terratest@v0.0.0-20230214120104-7ec6de2e1ae0/examples/helm-dependency-example/README.md (about)

     1  # Helm Dependency Example
     2  
     3  This folder contains a minimal helm chart to demonstrate how you can use Terratest to test your helm charts with dependencies.
     4  
     5  There are two kinds of tests you can perform on a helm chart:
     6  
     7  - Helm Template tests are tests designed to test the logic of the templates. These tests should run `helm template` with
     8    various input values and parse the yaml to validate any logic embedded in the templates (e.g by reading them in using
     9    client-go). Since templates are not statically typed, the goal of these tests is to promote fast cycle time
    10  
    11  The helm chart deploys a single replica `Deployment` resource given the container image spec and a `Service` that
    12  exposes it. This chart requires the `containerImageRepo` and `containerImageTag` input values.
    13  
    14  See the corresponding terratest code for an example of how to test this chart:
    15  
    16  - [helm_basic_example_template_test.go](/test/helm_basic_example_template_test.go): the template tests for this chart.
    17  
    18  ## Running automated tests against this Helm Chart
    19  
    20  1. Install and setup [helm](https://docs.helm.sh/using_helm/#installing-helm)
    21  1. Install [Golang](https://golang.org/) and make sure this code is checked out into your `GOPATH`.
    22  1. `cd test`
    23  1. `dep ensure`
    24  1. `go test -v -tags helm -run TestHelmDependencyExampleTemplate` for the template test
    25  
    26  **NOTE**: we have build tags to differentiate kubernetes tests from non-kubernetes tests, and further differentiate helm
    27  tests. This is done because minikube is heavy and can interfere with docker related tests in terratest. Similarly, helm
    28  can overload the minikube system and thus interfere with the other kubernetes tests. Specifically, many of the tests
    29  start to fail with `connection refused` errors from `minikube`. To avoid overloading the system, we run the kubernetes
    30  tests and helm tests separately from the others. This may not be necessary if you have a sufficiently powerful machine.
    31  We recommend at least 4 cores and 16GB of RAM if you want to run all the tests together.