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

Modified existing unit test to verify the changed behavior.
Removed debug print.
parent 1cebc760
...@@ -177,8 +177,6 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap { ...@@ -177,8 +177,6 @@ func (e *Engine) alterFuncMap(t *template.Template) template.FuncMap {
basePath: basePath.(string), basePath: basePath.(string),
} }
println(vals.Table)
templates := map[string]renderable{} templates := map[string]renderable{}
templateName, err := vals.PathValue("Template.Name") templateName, err := vals.PathValue("Template.Name")
if err != nil { if err != nil {
......
...@@ -538,7 +538,7 @@ func TestAlterFuncMap(t *testing.T) { ...@@ -538,7 +538,7 @@ func TestAlterFuncMap(t *testing.T) {
Metadata: &chart.Metadata{Name: "TplFunction"}, Metadata: &chart.Metadata{Name: "TplFunction"},
Templates: []*chart.Template{ Templates: []*chart.Template{
{Name: "templates/base", Data: []byte(`{{ tpl "{{include ` + "`" + `TplFunction/templates/_partial` + "`" + ` . | quote }}" .}}`)}, {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: ``}, Values: &chart.Config{Raw: ``},
Dependencies: []*chart.Chart{}, Dependencies: []*chart.Chart{},
...@@ -558,7 +558,7 @@ func TestAlterFuncMap(t *testing.T) { ...@@ -558,7 +558,7 @@ func TestAlterFuncMap(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
expectedTplStrWithInclude := "\"TestRelease\"" expectedTplStrWithInclude := "\"TplFunction/templates/base\""
if gotStrTplWithInclude := outTplWithInclude["TplFunction/templates/base"]; gotStrTplWithInclude != expectedTplStrWithInclude { if gotStrTplWithInclude := outTplWithInclude["TplFunction/templates/base"]; gotStrTplWithInclude != expectedTplStrWithInclude {
t.Errorf("Expected %q, got %q (%v)", expectedTplStrWithInclude, gotStrTplWithInclude, outTplWithInclude) t.Errorf("Expected %q, got %q (%v)", expectedTplStrWithInclude, gotStrTplWithInclude, outTplWithInclude)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment