Skip to content

Commit 2b785a1

Browse files
committed
changed os.setenv in ginkgo tes
cases Signed-off-by: Alka Kumari <alkumari@redhat.com>
1 parent 60385b9 commit 2b785a1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/openshift/e2e/ginkgo/sequential/1-115_validate_imagepullpolicy_console_plugin_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,11 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
280280

281281
By("adding image pull policy env variable to IMAGE_PULL_POLICY in Subscription")
282282

283-
os.Setenv("IMAGE_PULL_POLICY", "Always")
283+
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Always")
284+
defer func() {
285+
By("removing IMAGE_PULL_POLICY environment variable to restore default behavior")
286+
fixture.RestoreSubcriptionToDefault()
287+
}()
284288

285289
By("verifying Argo CD in openshift-gitops exists and is available")
286290
argoCD, err := argocdFixture.GetOpenShiftGitOpsNSArgoCD()
@@ -331,7 +335,11 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
331335

332336
By("updating image pull policy env variable to Never")
333337

334-
os.Setenv("IMAGE_PULL_POLICY", "Never")
338+
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Never")
339+
defer func() {
340+
By("removing IMAGE_PULL_POLICY environment variable to restore default behavior")
341+
fixture.RestoreSubcriptionToDefault()
342+
}()
335343

336344
By("verifying backend deployment has ImagePullPolicy changed based on env variable")
337345
Eventually(func() bool {
@@ -362,7 +370,11 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
362370
return true
363371
}, "3m", "5s").Should(BeTrue())
364372

365-
os.Setenv("IMAGE_PULL_POLICY", "IfNotPresent")
373+
fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "IfNotPresent")
374+
defer func() {
375+
By("removing IMAGE_PULL_POLICY environment variable to restore default behavior")
376+
fixture.RestoreSubcriptionToDefault()
377+
}()
366378

367379
By("verifying backend deployment has ImagePullPolicy changed based on env variable")
368380
Eventually(func() bool {

0 commit comments

Comments
 (0)