MCPcopy
hub / github.com/helm/helm / TestRenderRefsOrdering

Function TestRenderRefsOrdering

pkg/engine/engine_test.go:145–185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

143}
144
145func TestRenderRefsOrdering(t *testing.T) {
146 modTime := time.Now()
147
148 parentChart := &chart.Chart{
149 Metadata: &chart.Metadata{
150 Name: "parent",
151 Version: "1.2.3",
152 },
153 Templates: []*common.File{
154 {Name: "templates/_helpers.tpl", ModTime: modTime, Data: []byte(`{{- define "test" -}}parent value{{- end -}}`)},
155 {Name: "templates/test.yaml", ModTime: modTime, Data: []byte(`{{ tpl "{{ include \"test\" . }}" . }}`)},
156 },
157 }
158 childChart := &chart.Chart{
159 Metadata: &chart.Metadata{
160 Name: "child",
161 Version: "1.2.3",
162 },
163 Templates: []*common.File{
164 {Name: "templates/_helpers.tpl", ModTime: modTime, Data: []byte(`{{- define "test" -}}child value{{- end -}}`)},
165 },
166 }
167 parentChart.AddDependency(childChart)
168
169 expect := map[string]string{
170 "parent/templates/test.yaml": "parent value",
171 }
172
173 for i := range 100 {
174 out, err := Render(parentChart, common.Values{})
175 if err != nil {
176 t.Fatalf("Failed to render templates: %s", err)
177 }
178
179 for name, data := range expect {
180 if out[name] != data {
181 t.Fatalf("Expected %q, got %q (iteration %d)", data, out[name], i+1)
182 }
183 }
184 }
185}
186
187func TestRenderInternals(t *testing.T) {
188 // Test the internals of the rendering tool.

Callers

nothing calls this directly

Calls 4

AddDependencyMethod · 0.95
RenderFunction · 0.85
NowMethod · 0.80
FatalfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…