@@ -127,21 +127,30 @@ var _ = Describe("Operator Group", func() {
127
127
}
128
128
_ , err = crc .OperatorsV1 ().OperatorGroups (opGroupNamespace ).Create (context .TODO (), & operatorGroup , metav1.CreateOptions {})
129
129
require .NoError (GinkgoT (), err )
130
- expectedOperatorGroupStatus := v1.OperatorGroupStatus {
131
- Namespaces : []string {opGroupNamespace , createdOtherNamespace .GetName ()},
132
- }
130
+
131
+ // fetched namespaces might be in any order
132
+ namespaces := map [string ]bool {}
133
+ namespaces [opGroupNamespace ] = true
134
+ namespaces [createdOtherNamespace .GetName ()] = true
133
135
134
136
log ("Waiting on operator group to have correct status" )
135
137
err = wait .Poll (pollInterval , pollDuration , func () (bool , error ) {
136
138
fetched , fetchErr := crc .OperatorsV1 ().OperatorGroups (opGroupNamespace ).Get (context .TODO (), operatorGroup .Name , metav1.GetOptions {})
137
139
if fetchErr != nil {
138
- return false , fetchErr
140
+ log (fmt .Sprintf ("error getting operatorgroup %s/%s: %v" , opGroupNamespace , operatorGroup .Name , err ))
141
+ return false , nil
139
142
}
140
- if len (fetched .Status .Namespaces ) > 0 {
141
- require . ElementsMatch ( GinkgoT (), expectedOperatorGroupStatus . Namespaces , fetched . Status . Namespaces , "have %# v" , fetched .Status .Namespaces )
142
- return true , nil
143
+ if len (namespaces ) != len ( fetched .Status .Namespaces ) {
144
+ log ( fmt . Sprintf ( "element length mismatch: %v vs % v" , namespaces , fetched .Status .Namespaces ) )
145
+ return false , nil
143
146
}
144
- return false , nil
147
+ for _ , v := range fetched .Status .Namespaces {
148
+ if ! namespaces [v ] {
149
+ log (fmt .Sprintf ("element values mismatch: %v vs %v" , namespaces , fetched .Status .Namespaces ))
150
+ return false , nil
151
+ }
152
+ }
153
+ return true , nil
145
154
})
146
155
require .NoError (GinkgoT (), err )
147
156
0 commit comments