mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-09-18 13:22:17 +00:00
Remove redundant env field
This commit is contained in:
@@ -152,8 +152,6 @@ func (c *Filter) setupExec() {
|
||||
c.Exec.Args = args
|
||||
}
|
||||
|
||||
var tmpDirEnvKey string = "TMPDIR"
|
||||
|
||||
// getArgs returns the command + args to run to spawn the container
|
||||
func (c *Filter) getCommand() (string, []string) {
|
||||
// run the container using docker. this is simpler than using the docker
|
||||
@@ -175,7 +173,7 @@ func (c *Filter) getCommand() (string, []string) {
|
||||
args = append(args, "--mount", storageMount.String())
|
||||
}
|
||||
|
||||
args = append(args, c.Env.GetDockerFlags()...)
|
||||
args = append(args, runtimeutil.NewContainerEnvFromStringSlice(c.Env).GetDockerFlags()...)
|
||||
a := append(args, c.Image)
|
||||
return "docker", a
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ package container
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -135,10 +134,11 @@ metadata:
|
||||
t.FailNow()
|
||||
}
|
||||
tt.instance.Exec.FunctionConfig = cfg
|
||||
tt.instance.Env.AddKeyValue("KYAML_TEST", "FOO")
|
||||
tt.instance.Env = append(tt.instance.Env, "KYAML_TEST=FOO")
|
||||
tt.instance.setupExec()
|
||||
|
||||
tt.expectedArgs = append(tt.expectedArgs, tt.instance.Env.GetDockerFlags()...)
|
||||
tt.expectedArgs = append(tt.expectedArgs,
|
||||
runtimeutil.NewContainerEnvFromStringSlice(tt.instance.Env).GetDockerFlags()...)
|
||||
tt.expectedArgs = append(tt.expectedArgs, tt.instance.Image)
|
||||
|
||||
if !assert.Equal(t, "docker", tt.instance.Exec.Path) {
|
||||
@@ -238,15 +238,3 @@ func TestFilter_ExitCode(t *testing.T) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
func TestIgnoreEnv(t *testing.T) {
|
||||
os.Setenv(tmpDirEnvKey, "")
|
||||
|
||||
fltr := Filter{ContainerSpec: runtimeutil.ContainerSpec{Image: "example.com:version"}}
|
||||
_, args := fltr.getCommand()
|
||||
for _, arg := range args {
|
||||
if arg == tmpDirEnvKey {
|
||||
t.Fatalf("%s should not be exported to container", tmpDirEnvKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user