Open erik-carlson opened 2 years ago
Ran into this recently also.
Must have several templates defined in the templates
array, due to one include
'ing the other. Then the assertion returns this:
can't get ["template"] from a non map type:
null
Specifying documentIndex: 1
resolves the issue.
Hello @erik-carlson,
The rendering of the 0.2.8 helm unittest is done with the 3.7.1 library, so the behaviour can indeed be different. I will try to update the libraries more regular, to align with the latest version.
Greetings, @quintush
b.t.w. the 0.2.9 version will use the current latest helm (3.10.0) library.
I just started using this tool and I'm trying to write tests for a chart that uses named templates and finding that the order of documents that unittest renders is different from that generated by helm template.
For instance if I have a chart with a named template for an Ingress resource and another for a ConfigMap resource, then I have one template file that includes the ingress first and then the configmap,
helm template
will actually show the ConfigMap first and then the Ingress. Then if I write a test to validate that the first document is a ConfigMap it fails and says that it is an Ingress. Furthermore, if I switch the order of theinclude
s the output ofhelm template
doesn't change, but it does change the result of the test.I assume that there is some kind of sorting going on in helm template that isn't happening with unittest. Barring changing the way that unittest works (I assume that this change would be non-trivial), is there a way either with unittest or helm that you know of for at least seeing the order of documents as unittest sees them? As it is finding the right index is trial and error.
I'm using helm 3.8.1 and unittest 0.2.8.