From f7ddd94ce4f03fef44c1fc740abb46619d99ecf7 Mon Sep 17 00:00:00 2001 From: Dong Gang Date: Thu, 15 Oct 2020 14:35:39 +0800 Subject: [PATCH] fix the unit test error Signed-off-by: Dong Gang --- pkg/lint/rules/values.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/lint/rules/values.go b/pkg/lint/rules/values.go index 189012650..fc5c020d5 100644 --- a/pkg/lint/rules/values.go +++ b/pkg/lint/rules/values.go @@ -60,6 +60,14 @@ func validateValuesFileExistence(valuesPath string) error { return nil } +func copyMap(src map[string]interface{}) map[string]interface{} { + m := make(map[string]interface{}, len(src)) + for k, v := range src { + m[k] = v + } + return m +} + func validateValuesFile(valuesPath string, overrides map[string]interface{}) error { values, err := chartutil.ReadValuesFile(valuesPath) if err != nil { @@ -71,7 +79,8 @@ func validateValuesFile(valuesPath string, overrides map[string]interface{}) err // We could change that. For now, though, we retain that strategy, and thus can // coalesce tables (like reuse-values does) instead of doing the full chart // CoalesceValues. - values = chartutil.CoalesceTables(overrides, values) + vv := copyMap(overrides) + values = chartutil.CoalesceTables(vv, values) ext := filepath.Ext(valuesPath) schemaPath := valuesPath[:len(valuesPath)-len(ext)] + ".schema.json"