From 93038ed8f4c73cdebb54d8d3af7ea34b8bb01c2b Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sat, 17 Jun 2023 15:25:08 +0200 Subject: [PATCH] s3: restore retries for minio tests --- internal/backend/s3/s3_test.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/backend/s3/s3_test.go b/internal/backend/s3/s3_test.go index 17f5f7016..3051d8ddb 100644 --- a/internal/backend/s3/s3_test.go +++ b/internal/backend/s3/s3_test.go @@ -7,15 +7,18 @@ import ( "fmt" "io" "net" + "net/http" "os" "os/exec" "path/filepath" "testing" "time" + "github.com/restic/restic/internal/backend/location" "github.com/restic/restic/internal/backend/s3" "github.com/restic/restic/internal/backend/test" "github.com/restic/restic/internal/options" + "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" ) @@ -114,7 +117,18 @@ func newMinioTestSuite(t testing.TB) (*test.Suite[s3.Config], func()) { return &cfg, nil }, - Factory: s3.NewFactory(), + Factory: location.NewHTTPBackendFactory("s3", s3.ParseConfig, location.NoPassword, func(ctx context.Context, cfg s3.Config, rt http.RoundTripper) (be restic.Backend, err error) { + for i := 0; i < 10; i++ { + be, err = s3.Create(ctx, cfg, rt) + if err != nil { + t.Logf("s3 open: try %d: error %v", i, err) + time.Sleep(500 * time.Millisecond) + continue + } + break + } + return be, err + }, s3.Open), }, func() { defer cancel() defer cleanup()