forked from TrueCloudLab/restic
Upgrade github.com/cenkalti/backoff module
We now use v4 of the module. `backoff.WithMaxRetries` no longer repeats an operation endlessly when a retry count of 0 is specified. This required a few fixes for the tests.
This commit is contained in:
parent
0ae02f3030
commit
b79f18209f
4 changed files with 9 additions and 20 deletions
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
||||||
github.com/Azure/azure-sdk-for-go v46.1.0+incompatible
|
github.com/Azure/azure-sdk-for-go v46.1.0+incompatible
|
||||||
github.com/Azure/go-autorest/autorest v0.11.6 // indirect
|
github.com/Azure/go-autorest/autorest v0.11.6 // indirect
|
||||||
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
|
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible
|
github.com/cenkalti/backoff/v4 v4.0.2
|
||||||
github.com/cespare/xxhash/v2 v2.1.1
|
github.com/cespare/xxhash/v2 v2.1.1
|
||||||
github.com/dchest/siphash v1.2.2
|
github.com/dchest/siphash v1.2.2
|
||||||
github.com/dnaeon/go-vcr v1.0.1 // indirect
|
github.com/dnaeon/go-vcr v1.0.1 // indirect
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -59,8 +59,8 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
|
github.com/cenkalti/backoff/v4 v4.0.2 h1:JIufpQLbh4DkbQoii76ItQIUFzevQSqOLZca4eamEDs=
|
||||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cenkalti/backoff"
|
"github.com/cenkalti/backoff/v4"
|
||||||
"github.com/restic/restic/internal/debug"
|
"github.com/restic/restic/internal/debug"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,9 +33,7 @@ func TestBackendSaveRetry(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
retryBackend := RetryBackend{
|
retryBackend := NewRetryBackend(be, 10, nil)
|
||||||
Backend: be,
|
|
||||||
}
|
|
||||||
|
|
||||||
data := test.Random(23, 5*1024*1024+11241)
|
data := test.Random(23, 5*1024*1024+11241)
|
||||||
err := retryBackend.Save(context.TODO(), restic.Handle{}, restic.NewByteReader(data))
|
err := retryBackend.Save(context.TODO(), restic.Handle{}, restic.NewByteReader(data))
|
||||||
|
@ -73,9 +71,7 @@ func TestBackendListRetry(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
retryBackend := RetryBackend{
|
retryBackend := NewRetryBackend(be, 10, nil)
|
||||||
Backend: be,
|
|
||||||
}
|
|
||||||
|
|
||||||
var listed []string
|
var listed []string
|
||||||
err := retryBackend.List(context.TODO(), restic.PackFile, func(fi restic.FileInfo) error {
|
err := retryBackend.List(context.TODO(), restic.PackFile, func(fi restic.FileInfo) error {
|
||||||
|
@ -104,9 +100,7 @@ func TestBackendListRetryErrorFn(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
retryBackend := RetryBackend{
|
retryBackend := NewRetryBackend(be, 10, nil)
|
||||||
Backend: be,
|
|
||||||
}
|
|
||||||
|
|
||||||
var ErrTest = errors.New("test error")
|
var ErrTest = errors.New("test error")
|
||||||
|
|
||||||
|
@ -162,10 +156,7 @@ func TestBackendListRetryErrorBackend(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxRetries = 2
|
const maxRetries = 2
|
||||||
retryBackend := RetryBackend{
|
retryBackend := NewRetryBackend(be, maxRetries, nil)
|
||||||
MaxTries: maxRetries,
|
|
||||||
Backend: be,
|
|
||||||
}
|
|
||||||
|
|
||||||
var listed []string
|
var listed []string
|
||||||
err := retryBackend.List(context.TODO(), restic.PackFile, func(fi restic.FileInfo) error {
|
err := retryBackend.List(context.TODO(), restic.PackFile, func(fi restic.FileInfo) error {
|
||||||
|
@ -234,9 +225,7 @@ func TestBackendLoadRetry(t *testing.T) {
|
||||||
return failingReader{data: data, limit: limit}, nil
|
return failingReader{data: data, limit: limit}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
retryBackend := RetryBackend{
|
retryBackend := NewRetryBackend(be, 10, nil)
|
||||||
Backend: be,
|
|
||||||
}
|
|
||||||
|
|
||||||
var buf []byte
|
var buf []byte
|
||||||
err := retryBackend.Load(context.TODO(), restic.Handle{}, 0, 0, func(rd io.Reader) (err error) {
|
err := retryBackend.Load(context.TODO(), restic.Handle{}, 0, 0, func(rd io.Reader) (err error) {
|
||||||
|
|
Loading…
Reference in a new issue