Testing and Error Handling with Helmfile
Learn how to test and lint Helm charts with Helmfile.
We'll cover the following...
The main reason why Helmfile is a very useful tool is that it allows the creation and update of multiple Helm releases. That’s the essence of it, but we can do more with it.
Run the test
Quality assurance is a vital part of any software development process. Helm creators knew that and added testing capabilities to it. Helmfile does not provide any new features, only allowing the use of what is already available in Helm.
Using the simple helmfile test
command we can run all the tests for each Helm release that are declared in each Helm chart. Such a command can be executed right after the rollout of a new version of any Service, to make sure that nothing has broken anything.
Let’s run this command against a local cluster. To make it even better, we can add the --logs
flag which will print the output from the testing Pods to the console:
helmfile test --logs
The simplified output (without the content of the NOTES.txt
file) will be similar to this one below:
Adding repo helm-app https://wkrzywiec.github.io/helm-app
"helm-app" already exists with the same configuration, skipping
Adding repo bitnami https://charts.bitnami.com/bitnami
"bitnami" already exists with the same configuration, skipping
Building dependency release=kanban-frontend, chart=app
Testing kanban-backend
Testing kanban-frontend
Testing postgres
NAME: postgres
LAST DEPLOYED: Sat Jan 29 21:24:31 2022
NAMESPACE: kanban
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: postgresql
CHART VERSION: 10.16.2
APP VERSION: 11.14.0
.....
NAME: kanban-backend
LAST DEPLOYED: Sat Jan 29 21:24:28 2022
NAMESPACE: kanban
STATUS: deployed
REVISION: 1
TEST SUITE: kanban-backend-connection-test
Last Started: Sat Jan 29 21:28:58 2022
Last Completed: Sat Jan 29 21:29:02 2022
Phase: Succeeded
NOTES:
...
POD LOGS: kanban-backend-connection-test
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 486 0 486 0 0 38051 0 --:--:-- --:--:-- --:--:-- 40500
{"_links":{"self":{"href":"http://kanban-backend:8080/api/actuator","templated":false},"health":{"href":"http://kanban-backend:8080/api/actuator/health","templated":false},"healt
...