diff --git a/functions/concrete/run/env/env_test.go b/functions/concrete/run/env/env_test.go new file mode 100644 index 00000000..5607cf31 --- /dev/null +++ b/functions/concrete/run/env/env_test.go @@ -0,0 +1,19 @@ +//go:build !integration + +package env + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestExpandValue_GitLabEnvTakesPriorityOverEnv(t *testing.T) { + e := &Env{ + Env: map[string]string{"MY_VAR": "static"}, + GitLabEnv: map[string]string{"MY_VAR": "dynamic"}, + } + + assert.Equal(t, "dynamic", e.ExpandValue("$MY_VAR"), + "GitLabEnv overlay must shadow Env for the same key") +}