Chart Tests
A test in a helm chart lives under the directory and is a pod definition that specifies a container with a given command to run. The container should exit successfully (exit 0) for a test to be considered a success. The pod definition must contain one of the helm test hook annotations: helm.sh/hook: test-success
or helm.sh/hook: test-failure
.
Example tests: - Validate that your configuration from the values.yaml file was properly injected. - Make sure your username and password work correctly - Make sure an incorrect username and password does not work - Assert that your services are up and correctly loadbalanced. - etc.
In Helm, there are two test hooks: and test-failure
test-success
indicates that test pod should complete successfully. In other words, the containers in the pod should exit 0. test-failure
is a way to assert that a test pod should not complete successfully. If the containers in the pod do not exit 0, that indicates success.
In :
$ helm install stable/wordpress
- You can define as many tests as you would like in a single yaml file or spread across several yaml files in the
templates/
directory - You are welcome to nest your test suite under a directory like
<chart-name>/templates/tests/
for more isolation