diff --git a/tools/watch/until.go b/tools/watch/until.go index 27080c16..a2474556 100644 --- a/tools/watch/until.go +++ b/tools/watch/until.go @@ -136,7 +136,7 @@ func UntilWithSync(ctx context.Context, lw cache.ListerWatcher, objType runtime. if precondition != nil { if !cache.WaitForCacheSync(ctx.Done(), informer.HasSynced) { - return nil, fmt.Errorf("UntilWithSync: unable to sync caches: %v", ctx.Err()) + return nil, fmt.Errorf("UntilWithSync: unable to sync caches: %w", ctx.Err()) } done, err := precondition(indexer) diff --git a/tools/watch/until_test.go b/tools/watch/until_test.go index e8ab6cab..2d64c423 100644 --- a/tools/watch/until_test.go +++ b/tools/watch/until_test.go @@ -19,6 +19,7 @@ package watch import ( "context" "errors" + "fmt" "reflect" "strings" "testing" @@ -227,7 +228,7 @@ func TestUntilWithSync(t *testing.T) { conditionFunc: func(e watch.Event) (bool, error) { return true, nil }, - expectedErr: errors.New("UntilWithSync: unable to sync caches: context deadline exceeded"), + expectedErr: fmt.Errorf("UntilWithSync: unable to sync caches: %w", context.DeadlineExceeded), expectedEvent: nil, }, {