@@ -2,7 +2,6 @@ package e2e
22
33import (
44 "context"
5-
65 "github.com/blang/semver/v4"
76 . "github.com/onsi/ginkgo/v2"
87 . "github.com/onsi/gomega"
@@ -88,11 +87,18 @@ var _ = Describe("CSV Namespace Labeler Plugin", func() {
8887 }).Should (HaveKeyWithValue (plugins .NamespaceLabelSyncerLabelKey , "true" ))
8988
9089 // delete label
91- ns := & v1.Namespace {}
92- Expect (determinedE2eClient .Get (context .Background (), k8scontrollerclient .ObjectKeyFromObject (& testNamespace ), ns )).To (Succeed ())
93- nsCopy := ns .DeepCopy ()
94- delete (nsCopy .Annotations , plugins .NamespaceLabelSyncerLabelKey )
95- Expect (determinedE2eClient .Update (context .Background (), nsCopy )).To (Succeed ())
90+ // NOTE: not using the determined client here because it shouldn't be used for update operations due to
91+ // race conditions (the updated resource could change b/w 'get' and 'update' operations
92+ c := ctx .Ctx ().E2EClient ()
93+ Eventually (func () error {
94+ ns := & v1.Namespace {}
95+ if err := c .Get (context .Background (), k8scontrollerclient .ObjectKeyFromObject (& testNamespace ), ns ); err != nil {
96+ return err
97+ }
98+ nsCopy := ns .DeepCopy ()
99+ delete (nsCopy .Annotations , plugins .NamespaceLabelSyncerLabelKey )
100+ return c .Update (context .Background (), nsCopy )
101+ }).Should (BeNil ())
96102
97103 // namespace should be labeled
98104 Eventually (func () (map [string ]string , error ) {
0 commit comments