From 29a295eb84ffdfd00e3174818123f37033a02a3e Mon Sep 17 00:00:00 2001 From: Adam Eijdenberg Date: Wed, 12 Jun 2019 10:05:05 +1000 Subject: [PATCH] Add test for existing merging behaviour of mixed types Signed-off-by: Adam Eijdenberg --- pkg/chartutil/values_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index af6c77d27..fb26c6938 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -585,3 +585,27 @@ anotherNewKey: } } } + +func TestOverriteTableItemWithNonTableValue(t *testing.T) { + // src has a table value for "foo" + src := map[string]interface{}{ + "foo": map[string]interface{}{ + "baz": "boz", + }, + } + + // dst has a non-table value for "foo" + dst := map[string]interface{}{ + "foo": "bar", + } + + // result - this may print a warning, but we has always "worked" + result := coalesceTables(dst, src, "") + expected := map[string]interface{}{ + "foo": "bar", + } + + if !reflect.DeepEqual(result, expected) { + t.Errorf("Expected %v, but got %v", expected, result) + } +}