mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-10 14:55:37 +02:00
Bump sprig to v3.1.0 and mergo 3.11 (#1456)
* Bump sprig to v3.1.0 test for mergeOverwrite * Let mergo not (accidentally) try to merge unexported fields This is also a good chance separate `HelmState` with the config loaded from YAML, which I had been wanting to do for a long time. Co-authored-by: Johannes Alkjær <johannes.alkjaer@wunderman.com> Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
co-authored by
Johannes Alkjær
Yusuke Kuoka
parent
efd26f288a
commit
9d2c0d4285
@@ -0,0 +1,23 @@
|
||||
package tmpl
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMergeOverwrite(t *testing.T) {
|
||||
ctx := &Context{}
|
||||
buf, err := ctx.RenderTemplateToBuffer(`
|
||||
{{- $v1 := dict "bool" true "int" 2 "str" "v1" "str2" "v1" -}}
|
||||
{{- $v2 := dict "bool" false "int" 0 "str" "v2" "str2" "" -}}
|
||||
{{- $mo1 := mergeOverwrite (dict) $v1 $v2 }}
|
||||
{{- $mo1 -}}
|
||||
`)
|
||||
expected := "map[bool:false int:0 str:v2 str2:]"
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
actual := buf.String()
|
||||
if actual != expected {
|
||||
t.Errorf("unexpected result: expected=%v, actual=%v", expected, actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user