mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #114578 from ardaguclu/wrap-ctx-error-until
Embed context deadline exceeded in error to let errors.Is can work
This commit is contained in:
commit
b704b96565
@ -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)
|
||||
|
@ -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,
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user