Add test case for issue #7701 regression

Signed-off-by: Andre Sencioles <asenci@gmail.com>
pull/7702/head
Andre Sencioles 6 years ago
parent 96e809dfe7
commit c333f79a03

@ -126,6 +126,47 @@ func TestRender(t *testing.T) {
} }
} }
func TestRenderRefsOrdering(t *testing.T) {
parentChart := &chart.Chart{
Metadata: &chart.Metadata{
Name: "parent",
Version: "1.2.3",
},
Templates: []*chart.File{
{Name: "templates/_helpers.tpl", Data: []byte(`{{- define "test" -}}parent value{{- end -}}`)},
{Name: "templates/test.yaml", Data: []byte(`{{ tpl "{{ include \"test\" . }}" . }}`)},
},
}
childChart := &chart.Chart{
Metadata: &chart.Metadata{
Name: "child",
Version: "1.2.3",
},
Templates: []*chart.File{
{Name: "templates/_helpers.tpl", Data: []byte(`{{- define "test" -}}child value{{- end -}}`)},
},
}
parentChart.AddDependency(childChart)
expect := map[string]string{
"parent/templates/test.yaml": "parent value",
}
for i := 0; i < 100; i++ {
out, err := Render(parentChart, chartutil.Values{})
if err != nil {
t.Fatalf("Failed to render templates: %s", err)
}
for name, data := range expect {
if out[name] != data {
t.Fatalf("Expected %q, got %q (iteraction %d)", data, out[name], i+1)
}
}
}
}
func TestRenderInternals(t *testing.T) { func TestRenderInternals(t *testing.T) {
// Test the internals of the rendering tool. // Test the internals of the rendering tool.

Loading…
Cancel
Save