From 6085919236abb28a7155722895f8bc0ba1aef9e0 Mon Sep 17 00:00:00 2001 From: Bernd Gutjahr Date: Thu, 24 Sep 2020 12:29:51 +0200 Subject: [PATCH] enhanced coelesce_test to show what goes wrong Signed-off-by: Bernd Gutjahr --- pkg/chartutil/coalesce_test.go | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/pkg/chartutil/coalesce_test.go b/pkg/chartutil/coalesce_test.go index 5a4656d71..0c1b366ea 100644 --- a/pkg/chartutil/coalesce_test.go +++ b/pkg/chartutil/coalesce_test.go @@ -78,11 +78,20 @@ func TestCoalesceValues(t *testing.T) { "right": "exists", "scope": "moby", "top": "nope", + "global": map[string]interface{}{ + "nested2": map[string]interface{}{"l0": "moby"}, + }, }, }, withDeps(&chart.Chart{ Metadata: &chart.Metadata{Name: "pequod"}, - Values: map[string]interface{}{"name": "pequod", "scope": "pequod"}, + Values: map[string]interface{}{ + "name": "pequod", + "scope": "pequod", + "global": map[string]interface{}{ + "nested2": map[string]interface{}{"l1": "pequod"}, + }, + }, }, &chart.Chart{ Metadata: &chart.Metadata{Name: "ahab"}, @@ -91,12 +100,20 @@ func TestCoalesceValues(t *testing.T) { "name": "ahab", "boat": true, "nested": map[string]interface{}{"foo": false, "bar": true}, + "global": map[string]interface{}{ + "nested2": map[string]interface{}{"l2": "ahab"}, + }, }, }, ), &chart.Chart{ Metadata: &chart.Metadata{Name: "spouter"}, - Values: map[string]interface{}{"scope": "spouter"}, + Values: map[string]interface{}{ + "scope": "spouter", + "global": map[string]interface{}{ + "nested2": map[string]interface{}{"l1": "spouter"}, + }, + }, }, ) @@ -147,6 +164,19 @@ func TestCoalesceValues(t *testing.T) { {"{{.spouter.global.nested.boat}}", "true"}, {"{{.pequod.global.nested.sail}}", "true"}, {"{{.spouter.global.nested.sail}}", ""}, + + {"{{.global.nested2.l0}}", "moby"}, + {"{{.global.nested2.l1}}", ""}, + {"{{.global.nested2.l2}}", ""}, + {"{{.pequod.global.nested2.l0}}", "moby"}, + {"{{.pequod.global.nested2.l1}}", "pequod"}, + {"{{.pequod.global.nested2.l2}}", ""}, + {"{{.pequod.ahab.global.nested2.l0}}", "moby"}, + {"{{.pequod.ahab.global.nested2.l1}}", "pequod"}, + {"{{.pequod.ahab.global.nested2.l2}}", "ahab"}, + {"{{.spouter.global.nested2.l0}}", "moby"}, + {"{{.spouter.global.nested2.l1}}", "spouter"}, + {"{{.spouter.global.nested2.l2}}", ""}, } for _, tt := range tests {