@@ -19,7 +19,6 @@ package sequential
1919import (
2020 "context"
2121 "fmt"
22- "os"
2322 "strings"
2423
2524 . "github.com/onsi/ginkgo/v2"
@@ -280,14 +279,11 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
280279
281280 By ("adding image pull policy env variable IMAGE_PULL_POLICY in Subscription" )
282281
283- fixture .AddEnvVarToCSV (csv , "IMAGE_PULL_POLICY" , "Always" )
284- //fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Always")
285- Expect (k8sClient .Update (ctx , csv )).To (Succeed ())
282+ fixture .SetEnvInOperatorSubscriptionOrDeployment ("IMAGE_PULL_POLICY" , "Always" )
286283 defer func () {
287284 By ("removing IMAGE_PULL_POLICY environment variable to restore default behavior" )
288285 fixture .RestoreSubcriptionToDefault ()
289286 }()
290- fixture .WaitForOperatorPodToHaveEnvVar ("openshift-gitops-operator" , "IMAGE_PULL_POLICY" , "Always" , k8sClient )
291287
292288 By ("verifying Argo CD in openshift-gitops exists and is available" )
293289 argoCD , err := argocdFixture .GetOpenShiftGitOpsNSArgoCD ()
@@ -302,17 +298,33 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
302298 }
303299 Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (gitopsService ), gitopsService )).To (Succeed ())
304300
301+ By ("printing deployment ImagePullPolicy" )
302+ deployment := & appsv1.Deployment {ObjectMeta : metav1.ObjectMeta {Name : "cluster" , Namespace : "openshift-gitops" }}
303+ for _ , container := range deployment .Spec .Template .Spec .Containers {
304+ fmt .Println ("Container: " + container .Name + " is " + string (container .ImagePullPolicy ))
305+ }
306+
305307 By ("verifying backend deployment has ImagePullPolicy set based on env variable" )
306308 clusterDepl := & appsv1.Deployment {ObjectMeta : metav1.ObjectMeta {Name : "cluster" , Namespace : argoCD .Namespace }}
307309 Eventually (clusterDepl ).Should (k8sFixture .ExistByName ())
310+ fmt .Println ("Printing the list of deployment env variables" )
311+ envList := clusterDepl .Spec .Template .Spec .Containers [0 ].Env
312+ for _ , env := range envList {
313+ fmt .Println ("Env: " + env .Name + " is " + env .Value )
314+ }
315+
316+ envValue , err := fixture .GetEnvInOperatorSubscriptionOrDeployment ("IMAGE_PULL_POLICY" )
317+ Expect (err ).ToNot (HaveOccurred ())
318+ fmt .Println ("EnvValue: " + string (* envValue ))
319+
308320 Eventually (func () bool {
309321 err := k8sClient .Get (ctx , client .ObjectKeyFromObject (clusterDepl ), clusterDepl )
310322 if err != nil {
311323 return false
312324 }
313325 for _ , container := range clusterDepl .Spec .Template .Spec .Containers {
314326 if container .ImagePullPolicy != corev1 .PullAlways {
315- fmt .Println ("ImagePullPolicy is set to " + string (container .ImagePullPolicy ) + " but expected " + os . Getenv ( "IMAGE_PULL_POLICY" ) )
327+ fmt .Println ("ImagePullPolicy is set to " + string (container .ImagePullPolicy ))
316328 return false
317329 }
318330 }
@@ -338,14 +350,11 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
338350
339351 By ("updating image pull policy env variable to Never" )
340352
341- //fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "Never")
342- fixture .AddEnvVarToCSV (csv , "IMAGE_PULL_POLICY" , "Never" )
343- Expect (k8sClient .Update (ctx , csv )).To (Succeed ())
353+ fixture .SetEnvInOperatorSubscriptionOrDeployment ("IMAGE_PULL_POLICY" , "Never" )
344354 defer func () {
345355 By ("removing IMAGE_PULL_POLICY environment variable to restore default behavior" )
346356 fixture .RestoreSubcriptionToDefault ()
347357 }()
348- fixture .WaitForOperatorPodToHaveEnvVar ("openshift-gitops-operator" , "IMAGE_PULL_POLICY" , "Never" , k8sClient )
349358
350359 By ("verifying backend deployment has ImagePullPolicy changed based on env variable" )
351360 Eventually (func () bool {
@@ -376,14 +385,11 @@ var _ = Describe("GitOps Operator Parallel E2E Tests", func() {
376385 return true
377386 }, "3m" , "5s" ).Should (BeTrue ())
378387
379- //fixture.SetEnvInOperatorSubscriptionOrDeployment("IMAGE_PULL_POLICY", "IfNotPresent")
380- fixture .AddEnvVarToCSV (csv , "IMAGE_PULL_POLICY" , "IfNotPresent" )
381- Expect (k8sClient .Update (ctx , csv )).To (Succeed ())
388+ fixture .SetEnvInOperatorSubscriptionOrDeployment ("IMAGE_PULL_POLICY" , "IfNotPresent" )
382389 defer func () {
383390 By ("removing IMAGE_PULL_POLICY environment variable to restore default behavior" )
384391 fixture .RestoreSubcriptionToDefault ()
385392 }()
386- fixture .WaitForOperatorPodToHaveEnvVar ("openshift-gitops-operator" , "IMAGE_PULL_POLICY" , "IfNotPresent" , k8sClient )
387393
388394 By ("verifying backend deployment has ImagePullPolicy changed based on env variable" )
389395 Eventually (func () bool {
0 commit comments