test: added envvals_loader unit test for environment values

Signed-off-by: Vincent Chenal <vincent.chenal@protonmail.com>
This commit is contained in:
Vincent Chenal 2025-02-10 11:51:02 +01:00
parent dfd68faef0
commit 0a6bcf791b
No known key found for this signature in database
GPG Key ID: D0938A925FBBF580
2 changed files with 20 additions and 0 deletions

View File

@ -228,3 +228,22 @@ func TestEnvValsLoad_MultiHCL(t *testing.T) {
t.Error(diff) t.Error(diff)
} }
} }
func TestEnvValsLoad_EnvironmentValues(t *testing.T) {
l := newLoader()
env := environment.New("test")
env.Values["foo"] = "bar"
actual, err := l.LoadEnvironmentValues(nil, []any{"testdata/values.9.yaml.gotmpl"}, env, "")
if err != nil {
t.Fatal(err)
}
expected := map[string]any{
"foo": "bar",
}
if diff := cmp.Diff(expected, actual); diff != "" {
t.Error(diff)
}
}

View File

@ -0,0 +1 @@
foo: {{ .Values.foo }}