@@ -200,20 +200,15 @@ func TestOperator_syncFailingStatus(t *testing.T) {
200
200
}
201
201
202
202
type fakeRiFlags struct {
203
- unknownVersion bool
204
- reconciliationIssuesCondition bool
205
- statusReleaseArchitecture bool
206
- cvoConfiguration bool
203
+ unknownVersion bool
204
+ statusReleaseArchitecture bool
205
+ cvoConfiguration bool
207
206
}
208
207
209
208
func (f fakeRiFlags ) UnknownVersion () bool {
210
209
return f .unknownVersion
211
210
}
212
211
213
- func (f fakeRiFlags ) ReconciliationIssuesCondition () bool {
214
- return f .reconciliationIssuesCondition
215
- }
216
-
217
212
func (f fakeRiFlags ) StatusReleaseArchitecture () bool {
218
213
return f .statusReleaseArchitecture
219
214
}
@@ -222,59 +217,46 @@ func (f fakeRiFlags) CVOConfiguration() bool {
222
217
return f .cvoConfiguration
223
218
}
224
219
225
- func TestUpdateClusterVersionStatus_UnknownVersionAndReconciliationIssues (t * testing.T ) {
226
- ignoreLastTransitionTime := cmpopts .IgnoreFields (configv1.ClusterOperatorStatusCondition {}, "LastTransitionTime" )
227
-
220
+ // TODO: Can be removed in 4.21
221
+ func TestUpdateClusterVersionStatus_AlwaysRemove_ReconciliationIssues (t * testing.T ) {
228
222
testCases := []struct {
229
223
name string
230
224
231
225
unknownVersion bool
232
226
oldCondition * configv1.ClusterOperatorStatusCondition
233
227
failure error
234
-
235
- expectedRiCondition * configv1.ClusterOperatorStatusCondition
236
228
}{
237
229
{
238
- name : "ReconciliationIssues disabled, version known, no failure => condition not present" ,
239
- unknownVersion : false ,
240
- expectedRiCondition : nil ,
230
+ name : "version known, no failure => condition not present" ,
231
+ unknownVersion : false ,
241
232
},
242
233
{
243
- name : "ReconciliationIssues disabled, version known, failure => condition not present" ,
244
- unknownVersion : false ,
245
- failure : fmt .Errorf ("Something happened" ),
246
- expectedRiCondition : nil ,
234
+ name : "version known, failure => condition not present" ,
235
+ unknownVersion : false ,
236
+ failure : fmt .Errorf ("something happened" ),
247
237
},
248
238
{
249
- name : "ReconciliationIssues disabled, version unknown, failure, existing condition => condition present" ,
239
+ name : "version unknown, failure, existing condition => condition present" ,
250
240
oldCondition : & configv1.ClusterOperatorStatusCondition {
251
241
Type : reconciliationIssuesConditionType ,
252
242
Status : configv1 .ConditionFalse ,
253
- Reason : noReconciliationIssuesReason ,
243
+ Reason : " noReconciliationIssuesReason" ,
254
244
Message : "Happy condition is happy" ,
255
245
},
256
246
unknownVersion : true ,
257
- failure : fmt .Errorf ("Something happened" ),
258
- expectedRiCondition : & configv1.ClusterOperatorStatusCondition {
259
- Type : reconciliationIssuesConditionType ,
260
- Status : configv1 .ConditionTrue ,
261
- Reason : reconciliationIssuesFoundReason ,
262
- Message : `{"message":"Something happened"}` ,
263
- },
247
+ failure : fmt .Errorf ("something happened" ),
264
248
},
265
249
{
266
- name : "ReconciliationIssues disabled, version unknown, failure, no existing condition => condition not present" ,
267
- unknownVersion : true ,
268
- failure : fmt .Errorf ("Something happened" ),
269
- expectedRiCondition : nil ,
250
+ name : "version unknown, failure, no existing condition => condition not present" ,
251
+ unknownVersion : true ,
252
+ failure : fmt .Errorf ("something happened" ),
270
253
},
271
254
}
272
255
for _ , tc := range testCases {
273
256
tc := tc
274
257
t .Run (tc .name , func (t * testing.T ) {
275
258
gates := fakeRiFlags {
276
- unknownVersion : tc .unknownVersion ,
277
- reconciliationIssuesCondition : false ,
259
+ unknownVersion : tc .unknownVersion ,
278
260
}
279
261
release := configv1.Release {}
280
262
getAvailableUpdates := func () * availableUpdates { return nil }
@@ -285,80 +267,15 @@ func TestUpdateClusterVersionStatus_UnknownVersionAndReconciliationIssues(t *tes
285
267
}
286
268
updateClusterVersionStatus (& cvStatus , & SyncWorkerStatus {Failure : tc .failure }, release , getAvailableUpdates , gates , noErrors )
287
269
condition := resourcemerge .FindOperatorStatusCondition (cvStatus .Conditions , reconciliationIssuesConditionType )
288
- if diff := cmp . Diff ( tc . expectedRiCondition , condition , ignoreLastTransitionTime ); diff != "" {
289
- t .Errorf ("unexpected condition\n :%s " , diff )
270
+ if condition != nil {
271
+ t .Errorf ("expected condition %s to not be present, but it was: %v " , reconciliationIssuesConditionType , condition )
290
272
}
291
273
})
292
274
293
275
}
294
276
295
277
}
296
278
297
- func TestUpdateClusterVersionStatus_ReconciliationIssues (t * testing.T ) {
298
- ignoreLastTransitionTime := cmpopts .IgnoreFields (configv1.ClusterOperatorStatusCondition {}, "LastTransitionTime" )
299
-
300
- testCases := []struct {
301
- name string
302
- syncWorkerStatus SyncWorkerStatus
303
-
304
- enabled bool
305
-
306
- expectedCondition * configv1.ClusterOperatorStatusCondition
307
- }{
308
- {
309
- name : "ReconciliationIssues present and happy when gate is enabled and no failures happened" ,
310
- syncWorkerStatus : SyncWorkerStatus {},
311
- enabled : true ,
312
- expectedCondition : & configv1.ClusterOperatorStatusCondition {
313
- Type : reconciliationIssuesConditionType ,
314
- Status : configv1 .ConditionFalse ,
315
- Reason : noReconciliationIssuesReason ,
316
- Message : noReconciliationIssuesMessage ,
317
- },
318
- },
319
- {
320
- name : "ReconciliationIssues present and unhappy when gate is enabled and failures happened" ,
321
- syncWorkerStatus : SyncWorkerStatus {
322
- Failure : fmt .Errorf ("Something happened" ),
323
- },
324
- enabled : true ,
325
- expectedCondition : & configv1.ClusterOperatorStatusCondition {
326
- Type : reconciliationIssuesConditionType ,
327
- Status : configv1 .ConditionTrue ,
328
- Reason : reconciliationIssuesFoundReason ,
329
- Message : `{"message":"Something happened"}` ,
330
- },
331
- },
332
- {
333
- name : "ReconciliationIssues not present when gate is enabled and failures happened" ,
334
- syncWorkerStatus : SyncWorkerStatus {
335
- Failure : fmt .Errorf ("Something happened" ),
336
- },
337
- enabled : false ,
338
- expectedCondition : nil ,
339
- },
340
- }
341
-
342
- for _ , tc := range testCases {
343
- tc := tc
344
- t .Run (tc .name , func (t * testing.T ) {
345
- gates := fakeRiFlags {
346
- unknownVersion : false ,
347
- reconciliationIssuesCondition : tc .enabled ,
348
- }
349
- release := configv1.Release {}
350
- getAvailableUpdates := func () * availableUpdates { return nil }
351
- var noErrors field.ErrorList
352
- cvStatus := configv1.ClusterVersionStatus {}
353
- updateClusterVersionStatus (& cvStatus , & tc .syncWorkerStatus , release , getAvailableUpdates , gates , noErrors )
354
- condition := resourcemerge .FindOperatorStatusCondition (cvStatus .Conditions , reconciliationIssuesConditionType )
355
- if diff := cmp .Diff (tc .expectedCondition , condition , ignoreLastTransitionTime ); diff != "" {
356
- t .Errorf ("unexpected condition\n :%s" , diff )
357
- }
358
- })
359
- }
360
- }
361
-
362
279
func TestUpdateClusterVersionStatus_FilteringMultipleErrorsForFailingCondition (t * testing.T ) {
363
280
ignoreLastTransitionTime := cmpopts .IgnoreFields (configv1.ClusterOperatorStatusCondition {}, "LastTransitionTime" )
364
281
type args struct {
0 commit comments