Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Shell32-Natsu committed Aug 5, 2020
1 parent c99bc47 commit 2f7241f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion kyaml/fn/runtime/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions kyaml/fn/runtime/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 2f7241f

Please sign in to comment.