File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package retry
1818
1919import (
2020 "context"
21+ "errors"
2122 "fmt"
2223
2324 "github.com/google/go-containerregistry/internal/retry/wait"
@@ -36,7 +37,7 @@ type temporary interface {
3637
3738// IsTemporary returns true if err implements Temporary() and it returns true.
3839func IsTemporary (err error ) bool {
39- if err == context .DeadlineExceeded {
40+ if errors . Is ( err , context .DeadlineExceeded ) {
4041 return false
4142 }
4243 if te , ok := err .(temporary ); ok && te .Temporary () {
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ package retry
1717import (
1818 "context"
1919 "fmt"
20+ "net/http"
21+ "net/url"
2022 "testing"
2123)
2224
@@ -55,6 +57,14 @@ func TestRetry(t *testing.T) {
5557 predicate : IsTemporary ,
5658 err : context .DeadlineExceeded ,
5759 shouldRetry : false ,
60+ }, {
61+ predicate : IsTemporary ,
62+ err : & url.Error {
63+ Op : http .MethodPost ,
64+ URL : "http://127.0.0.1:56520/v2/example/blobs/uploads/" ,
65+ Err : context .DeadlineExceeded ,
66+ },
67+ shouldRetry : false ,
5868 }} {
5969 // Make sure we retry 5 times if we shouldRetry.
6070 steps := 5
You can’t perform that action at this time.
0 commit comments