@@ -232,89 +232,6 @@ func (nt *NT) WatchForSync(
232
232
return nil
233
233
}
234
234
235
- // WaitForRootSyncSourceError waits until the given error (code and message) is present on the RootSync resource
236
- func (nt * NT ) WaitForRootSyncSourceError (rsName , code string , message string , opts ... WaitOption ) {
237
- nt .T .Helper ()
238
- Wait (nt .T , fmt .Sprintf ("RootSync %s source error code %s" , rsName , code ), nt .DefaultWaitTimeout ,
239
- func () error {
240
- nt .T .Helper ()
241
- rs := k8sobjects .RootSyncObjectV1Beta1 (rsName )
242
- if err := nt .KubeClient .Get (rs .GetName (), rs .GetNamespace (), rs ); err != nil {
243
- return err
244
- }
245
- // Only validate the rendering status, not the Syncing condition
246
- // TODO: Remove this hack once async sync status updates are fixed to reflect only the latest commit.
247
- return testpredicates .ValidateError (rs .Status .Source .Errors , code , message , nil )
248
- // syncingCondition := rootsync.GetCondition(rs.Status.Conditions, v1beta1.RootSyncSyncing)
249
- // return validateRootSyncError(rs.Status.Source.Errors, syncingCondition, code, message, []v1beta1.ErrorSource{v1beta1.SourceError})
250
- },
251
- opts ... ,
252
- )
253
- }
254
-
255
- // WaitForRootSyncSyncError waits until the given error (code and message) is present on the RootSync resource
256
- func (nt * NT ) WaitForRootSyncSyncError (rsName , code string , message string , resources []v1beta1.ResourceRef , opts ... WaitOption ) {
257
- nt .T .Helper ()
258
- Wait (nt .T , fmt .Sprintf ("RootSync %s sync error code %s" , rsName , code ), nt .DefaultWaitTimeout ,
259
- func () error {
260
- nt .T .Helper ()
261
- rs := k8sobjects .RootSyncObjectV1Beta1 (rsName )
262
- err := nt .KubeClient .Get (rs .GetName (), rs .GetNamespace (), rs )
263
- if err != nil {
264
- return err
265
- }
266
- // Only validate the sync status, not the Syncing condition
267
- // TODO: Remove this hack once async sync status updates are fixed to reflect only the latest commit.
268
- return testpredicates .ValidateError (rs .Status .Sync .Errors , code , message , resources )
269
- // syncingCondition := rootsync.GetCondition(rs.Status.Conditions, v1beta1.RootSyncSyncing)
270
- // return validateRootSyncError(rs.Status.Sync.Errors, syncingCondition, code, message, []v1beta1.ErrorSource{v1beta1.SyncError})
271
- },
272
- opts ... ,
273
- )
274
- }
275
-
276
- // WaitForRepoSyncSyncError waits until the given error (code and message) is present on the RepoSync resource
277
- func (nt * NT ) WaitForRepoSyncSyncError (ns , rsName , code string , message string , resources []v1beta1.ResourceRef , opts ... WaitOption ) {
278
- nt .T .Helper ()
279
- Wait (nt .T , fmt .Sprintf ("RepoSync %s/%s sync error code %s" , ns , rsName , code ), nt .DefaultWaitTimeout ,
280
- func () error {
281
- nt .T .Helper ()
282
- rs := k8sobjects .RepoSyncObjectV1Beta1 (ns , rsName )
283
- err := nt .KubeClient .Get (rs .GetName (), rs .GetNamespace (), rs )
284
- if err != nil {
285
- return err
286
- }
287
- // Only validate the sync status, not the Syncing condition
288
- // TODO: Remove this hack once async sync status updates are fixed to reflect only the latest commit.
289
- return testpredicates .ValidateError (rs .Status .Sync .Errors , code , message , resources )
290
- // syncingCondition := reposync.GetCondition(rs.Status.Conditions, v1beta1.RepoSyncSyncing)
291
- // return validateRepoSyncError(rs.Status.Sync.Errors, syncingCondition, code, message, []v1beta1.ErrorSource{v1beta1.SyncError})
292
- },
293
- opts ... ,
294
- )
295
- }
296
-
297
- // WaitForRepoSyncSourceError waits until the given error (code and message) is present on the RepoSync resource
298
- func (nt * NT ) WaitForRepoSyncSourceError (ns , rsName , code , message string , opts ... WaitOption ) {
299
- nt .T .Helper ()
300
- Wait (nt .T , fmt .Sprintf ("RepoSync %s/%s source error code %s" , ns , rsName , code ), nt .DefaultWaitTimeout ,
301
- func () error {
302
- nt .T .Helper ()
303
- rs := k8sobjects .RepoSyncObjectV1Beta1 (ns , rsName )
304
- err := nt .KubeClient .Get (rs .GetName (), rs .GetNamespace (), rs )
305
- if err != nil {
306
- return err
307
- }
308
- // Only validate the rendering status, not the Syncing condition
309
- // TODO: Remove this hack once async sync status updates are fixed to reflect only the latest commit.
310
- return testpredicates .ValidateError (rs .Status .Source .Errors , code , message , nil )
311
- // syncingCondition := reposync.GetCondition(rs.Status.Conditions, v1beta1.RepoSyncSyncing)
312
- // return validateRepoSyncError(rs.Status.Source.Errors, syncingCondition, code, message, []v1beta1.ErrorSource{v1beta1.SourceError})
313
- },
314
- opts ... ,
315
- )
316
- }
317
-
318
235
// WaitForRootSyncStalledError waits until the given Stalled error is present on the RootSync resource.
319
236
func (nt * NT ) WaitForRootSyncStalledError (rsName , reason , message string ) {
320
237
nt .T .Helper ()
@@ -378,37 +295,3 @@ func (nt *NT) WaitForRepoSyncStalledError(rsNamespace, rsName, reason, message s
378
295
return nil
379
296
})
380
297
}
381
-
382
- // TODO: Uncomment when Syncing condition consistency is fixed
383
- // func validateRootSyncError(statusErrs []v1beta1.ConfigSyncError, syncingCondition *v1beta1.RootSyncCondition, code string, message string, expectedErrorSourceRefs []v1beta1.ErrorSource) error {
384
- // if err := testpredicates.ValidateError(statusErrs, code, message); err != nil {
385
- // return err
386
- // }
387
- // if syncingCondition == nil {
388
- // return fmt.Errorf("syncingCondition is nil")
389
- // }
390
- // if syncingCondition.Status == metav1.ConditionTrue {
391
- // return fmt.Errorf("status.conditions['Syncing'].status is True, expected false")
392
- // }
393
- // if !reflect.DeepEqual(syncingCondition.ErrorSourceRefs, expectedErrorSourceRefs) {
394
- // return fmt.Errorf("status.conditions['Syncing'].errorSourceRefs is %v, expected %v", syncingCondition.ErrorSourceRefs, expectedErrorSourceRefs)
395
- // }
396
- // return nil
397
- // }
398
-
399
- // TODO: Uncomment when Syncing condition consistency is fixed
400
- // func validateRepoSyncError(statusErrs []v1beta1.ConfigSyncError, syncingCondition *v1beta1.RepoSyncCondition, code string, message string, expectedErrorSourceRefs []v1beta1.ErrorSource) error {
401
- // if err := testpredicates.ValidateError(statusErrs, code, message); err != nil {
402
- // return err
403
- // }
404
- // if syncingCondition == nil {
405
- // return fmt.Errorf("syncingCondition is nil")
406
- // }
407
- // if syncingCondition.Status == metav1.ConditionTrue {
408
- // return fmt.Errorf("status.conditions['Syncing'].status is True, expected false")
409
- // }
410
- // if !reflect.DeepEqual(syncingCondition.ErrorSourceRefs, expectedErrorSourceRefs) {
411
- // return fmt.Errorf("status.conditions['Syncing'].errorSourceRefs is %v, expected %v", syncingCondition.ErrorSourceRefs, expectedErrorSourceRefs)
412
- // }
413
- // return nil
414
- // }
0 commit comments