review: feedback

Signed-off-by: Alex Pana <8968914+acpana@users.noreply.github.com>
This commit is contained in:
Alex Pana
2025-06-26 18:25:42 +00:00
parent 8bd8c14312
commit e82d4f8e55
2 changed files with 3 additions and 2 deletions

View File

@@ -151,7 +151,8 @@ func v1EnvVarsToMap(envs []v1.EnvVar) map[string]string {
}
// ExpandContainerCommandOnlyStatic substitutes only static environment variable values from the
// container environment definitions. This does *not* include valueFrom substitutions.
// container environment definitions. This does *not* include valueFrom substitutions. Note any unbound
// variables will not be expanded or empty substituted, i.e. "echo $(MISSING) => echo $(MISSING)".
// TODO: callers should use ExpandContainerCommandAndArgs with a fully resolved list of environment.
func ExpandContainerCommandOnlyStatic(containerCommand []string, envs []v1.EnvVar) (command []string) {
mapping := expansion.MappingFuncFor(v1EnvVarsToMap(envs))

View File

@@ -1159,7 +1159,7 @@ func TestExpandContainerCommandOnlyStatic(t *testing.T) {
envs: []v1.EnvVar{
{Name: "FOO", Value: "foo-value"},
},
expected: []string{"echo", "foo-value", "$(MISSING)"}, // should this behave as "echo", "foo-value", "" ?
expected: []string{"echo", "foo-value", "$(MISSING)"},
},
}