|
|
|
@ -215,11 +215,13 @@ func TestRenderNestedValues(t *testing.T) {
|
|
|
|
|
innerpath := "charts/inner/templates/inner.tpl"
|
|
|
|
|
outerpath := "templates/outer.tpl"
|
|
|
|
|
deepestpath := "charts/inner/charts/deepest/templates/deepest.tpl"
|
|
|
|
|
checkrelease := "charts/inner/charts/deepest/templates/release.tpl"
|
|
|
|
|
|
|
|
|
|
deepest := &chart.Chart{
|
|
|
|
|
Metadata: &chart.Metadata{Name: "deepest"},
|
|
|
|
|
Templates: []*chart.Template{
|
|
|
|
|
{Name: deepestpath, Data: []byte(`And this same {{.what}} that smiles {{.global.when}}`)},
|
|
|
|
|
{Name: deepestpath, Data: []byte(`And this same {{.Values.what}} that smiles {{.Values.global.when}}`)},
|
|
|
|
|
{Name: checkrelease, Data: []byte(`Tomorrow will be {{default "happy" .Release.Name }}`)},
|
|
|
|
|
},
|
|
|
|
|
Values: &chart.Config{Raw: `what: "milkshake"`},
|
|
|
|
|
}
|
|
|
|
@ -227,7 +229,7 @@ func TestRenderNestedValues(t *testing.T) {
|
|
|
|
|
inner := &chart.Chart{
|
|
|
|
|
Metadata: &chart.Metadata{Name: "herrick"},
|
|
|
|
|
Templates: []*chart.Template{
|
|
|
|
|
{Name: innerpath, Data: []byte(`Old {{.who}} is still a-flyin'`)},
|
|
|
|
|
{Name: innerpath, Data: []byte(`Old {{.Values.who}} is still a-flyin'`)},
|
|
|
|
|
},
|
|
|
|
|
Values: &chart.Config{Raw: `who: "Robert"`},
|
|
|
|
|
Dependencies: []*chart.Chart{deepest},
|
|
|
|
@ -236,7 +238,7 @@ func TestRenderNestedValues(t *testing.T) {
|
|
|
|
|
outer := &chart.Chart{
|
|
|
|
|
Metadata: &chart.Metadata{Name: "top"},
|
|
|
|
|
Templates: []*chart.Template{
|
|
|
|
|
{Name: outerpath, Data: []byte(`Gather ye {{.what}} while ye may`)},
|
|
|
|
|
{Name: outerpath, Data: []byte(`Gather ye {{.Values.what}} while ye may`)},
|
|
|
|
|
},
|
|
|
|
|
Values: &chart.Config{
|
|
|
|
|
Raw: `
|
|
|
|
@ -258,11 +260,19 @@ global:
|
|
|
|
|
when: to-day`,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inject, err := chartutil.CoalesceValues(outer, &injValues, map[string]interface{}{})
|
|
|
|
|
tmp, err := chartutil.CoalesceValues(outer, &injValues, map[string]interface{}{})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("Failed to coalesce values: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inject := chartutil.Values{
|
|
|
|
|
"Values": tmp,
|
|
|
|
|
"Chart": outer.Metadata,
|
|
|
|
|
"Release": chartutil.Values{
|
|
|
|
|
"Name": "dyin",
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t.Logf("Calculated values: %v", inject)
|
|
|
|
|
|
|
|
|
|
out, err := e.Render(outer, inject)
|
|
|
|
@ -281,4 +291,8 @@ global:
|
|
|
|
|
if out[deepestpath] != "And this same flower that smiles to-day" {
|
|
|
|
|
t.Errorf("Unexpected deepest: %q", out[deepestpath])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if out[checkrelease] != "Tomorrow will be dyin" {
|
|
|
|
|
t.Errorf("Unexpected release: %q", out[checkrelease])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|