Skip to content

Commit 14d5ab2

Browse files
committed
Making the RemoveEnv method work across all containers in a deployment, instead asserting there is exactly one container.
1 parent 0f46891 commit 14d5ab2

File tree

1 file changed

+11
-13
lines changed
  • test/openshift/e2e/ginkgo/fixture/deployment

1 file changed

+11
-13
lines changed

test/openshift/e2e/ginkgo/fixture/deployment/fixture.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,21 @@ func RemoveEnv(depl *appsv1.Deployment, key string) {
8585
Update(depl, func(d *appsv1.Deployment) {
8686
containers := d.Spec.Template.Spec.Containers
8787

88-
Expect(containers).Should(HaveLen(1))
89-
90-
newEnvVars := []corev1.EnvVar{}
88+
for idc := range containers {
89+
newEnvVars := []corev1.EnvVar{}
90+
for idx := range containers[idc].Env {
9191

92-
for idx := range containers[0].Env {
92+
currEnv := containers[idc].Env[idx]
9393

94-
currEnv := containers[0].Env[idx]
95-
96-
if currEnv.Name == key {
97-
// don't add, thus causing it to be removed
98-
} else {
99-
newEnvVars = append(newEnvVars, currEnv)
94+
if currEnv.Name == key {
95+
// don't add, thus causing it to be removed
96+
} else {
97+
newEnvVars = append(newEnvVars, currEnv)
98+
}
10099
}
101-
}
102-
103-
containers[0].Env = newEnvVars
104100

101+
containers[idc].Env = newEnvVars
102+
}
105103
})
106104

107105
}

0 commit comments

Comments
 (0)