client-go, kubectl: Replace deprecated ErrWaitTimeout with recommended method (#132718)

* client-go: Replace depracted ErrWaitTimeout with recommended method

* Fix UT and Integration tests

* IT test

Kubernetes-commit: ffe306d67958297202e9492ea644b42c0e7e694d
This commit is contained in:
Mayuka Channankaiah
2025-07-24 20:26:27 +05:30
committed by Kubernetes Publisher
parent 764374b324
commit 753cfe1811
6 changed files with 10 additions and 10 deletions

View File

@@ -202,7 +202,7 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName
// return if we've timed out
if err := ctx.Err(); err != nil {
return nil, wait.ErrWaitTimeout
return nil, wait.ErrorInterrupted(nil)
}
// see if the v1beta1 API is available
@@ -226,7 +226,7 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName
// return if we've timed out
if err := ctx.Err(); err != nil {
return nil, wait.ErrWaitTimeout
return nil, wait.ErrorInterrupted(nil)
}
// wait and try again
@@ -306,8 +306,8 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName
return false, nil
},
)
if err == wait.ErrWaitTimeout {
return nil, wait.ErrWaitTimeout
if wait.Interrupted(err) {
return nil, wait.ErrorInterrupted(nil)
}
if err != nil {
return nil, formatError("cannot watch on the certificate signing request: %v", err)

View File

@@ -59,7 +59,7 @@ func OnError(backoff wait.Backoff, retriable func(error) bool, fn func() error)
return false, err
}
})
if err == wait.ErrWaitTimeout {
if wait.Interrupted(err) {
err = lastErr
}
return err

View File

@@ -60,7 +60,7 @@ func TestSimpleQueue(t *testing.T) {
return false, nil
})
if err != wait.ErrWaitTimeout {
if !wait.Interrupted(err) {
t.Errorf("expected timeout, got: %v", err)
}