fix(helm): Apply PR comments for tpl template name fix

Modified existing unit test to verify the changed behavior.
Removed debug print.
This commit is contained in:
Lukas Eichler
2017-12-03 17:39:34 +01:00
parent 1cebc760a0
commit 8bc7dede18
2 changed files with 2 additions and 4 deletions

View File

@@ -177,8 +177,6 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap {
basePath: basePath.(string),
}
println(vals.Table)
templates := map[string]renderable{}
templateName, err := vals.PathValue("Template.Name")
if err != nil {

View File

@@ -538,7 +538,7 @@ func TestAlterFuncMap(t *testing.T) {
Metadata: &chart.Metadata{Name: "TplFunction"},
Templates: []*chart.Template{
{Name: "templates/base", Data: []byte(`{{ tpl "{{include ` + "`" + `TplFunction/templates/_partial` + "`" + ` . | quote }}" .}}`)},
{Name: "templates/_partial", Data: []byte(`{{.Release.Name}}`)},
{Name: "templates/_partial", Data: []byte(`{{.Template.Name}}`)},
},
Values: &chart.Config{Raw: ``},
Dependencies: []*chart.Chart{},
@@ -558,7 +558,7 @@ func TestAlterFuncMap(t *testing.T) {
t.Fatal(err)
}
expectedTplStrWithInclude := "\"TestRelease\""
expectedTplStrWithInclude := "\"TplFunction/templates/base\""
if gotStrTplWithInclude := outTplWithInclude["TplFunction/templates/base"]; gotStrTplWithInclude != expectedTplStrWithInclude {
t.Errorf("Expected %q, got %q (%v)", expectedTplStrWithInclude, gotStrTplWithInclude, outTplWithInclude)
}