mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
code review
This commit is contained in:
@@ -204,10 +204,11 @@ func (c *Filter) getCommand() (string, []string) {
|
||||
return "docker", a
|
||||
}
|
||||
|
||||
var ignoreEnvKey []string = []string{"TMPDIR"}
|
||||
|
||||
// shouldEnvIgnored returns true if the environment variable key should be ignored
|
||||
// by the container runtime.
|
||||
func shouldEnvIgnored(envKey string) bool {
|
||||
ignoreEnvKey := []string{"TMPDIR"}
|
||||
for _, k := range ignoreEnvKey {
|
||||
if k == envKey {
|
||||
return true
|
||||
|
||||
@@ -212,15 +212,14 @@ func TestFilter_ExitCode(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIgnoreEnv(t *testing.T) {
|
||||
ignoredEnvKey := []string{"TMPDIR"}
|
||||
for _, key := range ignoredEnvKey {
|
||||
for _, key := range ignoreEnvKey {
|
||||
os.Setenv(key, "")
|
||||
}
|
||||
|
||||
fltr := Filter{Image: "example.com:version"}
|
||||
_, args := fltr.getCommand()
|
||||
for _, arg := range args {
|
||||
for _, key := range ignoredEnvKey {
|
||||
for _, key := range ignoreEnvKey {
|
||||
if arg == key {
|
||||
t.Fatalf("%s should not be exported to container", key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user