Merge pull request #14560 from serathius/env

tests: Pass only etcd related environment variables during e2e tests
dependabot/go_modules/go.uber.org/atomic-1.10.0
Marek Siarkowicz 2022-11-04 11:24:07 +01:00 committed by GitHub
commit e614eec948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -143,6 +143,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]))
}