Skip to content

Commit d439da9

Browse files
committed
Implement env whitelist to reduce debug noise
Signed-off-by: apostasie <[email protected]>
1 parent 330ddf4 commit d439da9

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

mod/tigron/test/command.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func (gc *GenericCommand) WithBlacklist(env []string) {
142142
gc.cmd.EnvBlackList = env
143143
}
144144

145+
func (gc *GenericCommand) WithWhitelist(env []string) {
146+
gc.cmd.EnvWhiteList = env
147+
}
148+
145149
func (gc *GenericCommand) WithTimeout(timeout time.Duration) {
146150
gc.cmd.Timeout = timeout
147151
}

pkg/testutil/nerdtest/command.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,14 @@ func newNerdCommand(conf test.Config, t *testing.T) *nerdCommand {
8282
}
8383

8484
ret.WithBinary(binary)
85-
// Not interested in these - and insulate us from parent environment side effects
86-
ret.WithBlacklist([]string{
87-
"LS_COLORS",
88-
"DOCKER_CONFIG",
89-
"CONTAINERD_SNAPSHOTTER",
90-
"NERDCTL_TOML",
91-
"CONTAINERD_ADDRESS",
92-
"CNI_PATH",
93-
"NETCONFPATH",
94-
"NERDCTL_EXPERIMENTAL",
95-
"NERDCTL_HOST_GATEWAY_IP",
85+
ret.WithWhitelist([]string{
86+
"PATH",
87+
"HOME",
88+
"XDG_*",
89+
// Windows needs ProgramData, AppData, etc
90+
"Program*",
91+
"PROGRAM*",
92+
"APPDATA",
9693
})
9794
return ret
9895
}

0 commit comments

Comments
 (0)