You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really like this project, and it was good to see Helm 3 support being added!
I was stumped by some cryptic error messages I was getting from Helm Unittest today:
- manifest should match snapshot
- asserts[0] `matchSnapshot` fail
Error:
template "debug/templates/b.yaml" not exists or not selected in test suite
I've managed to workout what causes it though, if you have required values inside of a Helm Template (Using the required function e.g. {{ required ".someParameter is required" $.Values.someParameter }}.
Then even if you write a test for a different template that doesn't need this value, you get the above error.
To replicate:
helm create debug
cd debug
rm templates/*
rm -rf templates/tests
Create a.yaml in the templates directory
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ required ".someParameter is required" $.Values.someParameter }}
namespace: "test"
data:
a: "a"
templates:
- b.yaml
tests:
- it: manifest should match snapshot
asserts:
- matchSnapshot: {}
Notice that this solely tests b.yaml that has no required values
Run Helm Unit Test
helm unittest -3 .
You'll get this error:
### Chart [ debug ] .
FAIL tests/b_test.yaml
- manifest should match snapshot
- asserts[0] `matchSnapshot` fail
Error:
template "debug/templates/b.yaml" not exists or not selected in test suite
Charts: 1 failed, 0 passed, 1 total
Test Suites: 1 failed, 0 passed, 1 total
Tests: 1 failed, 0 passed, 1 total
Snapshot: 0 passed, 0 total
Time: 9.265483ms
Set someParameter in the test:
templates:
- b.yaml
tests:
- it: manifest should match snapshot
set:
someParameter: "fake"
asserts:
- matchSnapshot: {}
Run Helm Unit test again
helm unittest -3 .
The tests now pass:
### Chart [ debug ] .
PASS tests/b_test.yaml
Charts: 1 passed, 1 total
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshot: 1 passed, 1 total
Time: 2.310412ms
The text was updated successfully, but these errors were encountered:
I have a similar setup & example using helm's required function, however i'm using the failedTemplate assertion and get this cryptic message: yaml: found character that cannot start any token
Hi,
Really like this project, and it was good to see Helm 3 support being added!
I was stumped by some cryptic error messages I was getting from Helm Unittest today:
I've managed to workout what causes it though, if you have
required
values inside of a Helm Template (Using therequired
function e.g.{{ required ".someParameter is required" $.Values.someParameter }}
.Then even if you write a test for a different template that doesn't need this value, you get the above error.
To replicate:
Create
a.yaml
in thetemplates
directoryCreate
b.yaml
in thetemplates
directoryCreate a test case in
tests/b_test.yaml
Notice that this solely tests
b.yaml
that has no required valuesRun Helm Unit Test
helm unittest -3 .
You'll get this error:
Set
someParameter
in the test:Run Helm Unit test again
helm unittest -3 .
The tests now pass:
The text was updated successfully, but these errors were encountered: