From f8e2bace8de94d335e427456c2eb8c2ca3599894 Mon Sep 17 00:00:00 2001 From: Zhongcheng Lao Date: Fri, 23 Jul 2021 08:29:07 +0800 Subject: [PATCH] Add test case for set with boolean value and set-string behavior --- controllers/helmrelease_controller_test.go | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/controllers/helmrelease_controller_test.go b/controllers/helmrelease_controller_test.go index c1b762460..d18763086 100644 --- a/controllers/helmrelease_controller_test.go +++ b/controllers/helmrelease_controller_test.go @@ -107,6 +107,52 @@ other: values }, }, }, + { + name: "target path with boolean value", + resources: []runtime.Object{ + valuesSecret("values", map[string][]byte{"single": []byte("true")}), + }, + references: []v2.ValuesReference{ + { + Kind: "Secret", + Name: "values", + ValuesKey: "single", + TargetPath: "merge.at.specific.path", + }, + }, + want: chartutil.Values{ + "merge": map[string]interface{}{ + "at": map[string]interface{}{ + "specific": map[string]interface{}{ + "path": true, + }, + }, + }, + }, + }, + { + name: "target path with set-string behavior", + resources: []runtime.Object{ + valuesSecret("values", map[string][]byte{"single": []byte("\"true\"")}), + }, + references: []v2.ValuesReference{ + { + Kind: "Secret", + Name: "values", + ValuesKey: "single", + TargetPath: "merge.at.specific.path", + }, + }, + want: chartutil.Values{ + "merge": map[string]interface{}{ + "at": map[string]interface{}{ + "specific": map[string]interface{}{ + "path": "true", + }, + }, + }, + }, + }, { name: "values reference to non existing secret", references: []v2.ValuesReference{