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