tests: Pass only etcd related environment variables during e2e tests

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
Marek Siarkowicz 2022-10-07 21:33:54 +02:00
parent 2d638e0fd2
commit 81bd3fb9f9

View File

@ -127,6 +127,10 @@ func mergeEnvVariables(envVars map[string]string) []string {
currVars := os.Environ()
for _, v := range currVars {
p := strings.Split(v, "=")
// TODO: Remove PATH when we stop using system binaries (`awk`, `echo`)
if !strings.HasPrefix(p[0], "ETCD_") && !strings.HasPrefix(p[0], "ETCDCTL_") && !strings.HasPrefix(p[0], "EXPECT_") && p[0] != "PATH" {
continue
}
if _, ok := envVars[p[0]]; !ok {
env = append(env, fmt.Sprintf("%s=%s", p[0], p[1]))
}