"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fstest: let backends advertise maximum file size
Ivan Andreev661dc568f37a
diff --git a/fs/operations/multithread_test.go b/fs/operations/multithread_test.goindex a54b19f5e..9e125a702 100644--- a/fs/operations/multithread_test.go+++ b/fs/operations/multithread_test.go@@ -115,6 +115,9 @@ func TestMultithreadCopy(t *testing.T) {{size: multithreadChunkSize*2 + 1, streams: 2},} {t.Run(fmt.Sprintf("%+v", test), func(t *testing.T) {+ if *fstest.SizeLimit > 0 && int64(test.size) > *fstest.SizeLimit {+ t.Skipf("exceeded file size limit %d > %d", test.size, *fstest.SizeLimit)+ }var err errorcontents := random.String(test.size)t1 := fstest.Time("2001-02-03T04:05:06.499999999Z")diff --git a/fs/operations/operations_test.go b/fs/operations/operations_test.goindex 526690820..8fded2ebd 100644--- a/fs/operations/operations_test.go+++ b/fs/operations/operations_test.go@@ -445,6 +445,15 @@ func TestRcat(t *testing.T) {r := fstest.NewRun(t)defer r.Finalise()+ if *fstest.SizeLimit > 0 && int64(fs.Config.StreamingUploadCutoff) > *fstest.SizeLimit {+ savedCutoff := fs.Config.StreamingUploadCutoff+ defer func() {+ fs.Config.StreamingUploadCutoff = savedCutoff+ }()+ fs.Config.StreamingUploadCutoff = fs.SizeSuffix(*fstest.SizeLimit)+ t.Logf("Adjust StreamingUploadCutoff to size limit %s (was %s)", fs.Config.StreamingUploadCutoff, savedCutoff)+ }+fstest.CheckListing(t, r.Fremote, []fstest.Item{})data1 := "this is some really nice test data"diff --git a/fstest/fstest.go b/fstest/fstest.goindex 1924379c7..509d034bb 100644--- a/fstest/fstest.go+++ b/fstest/fstest.go@@ -42,6 +42,8 @@ var (Individual = flag.Bool("individual", false, "Make individual bucket/container/directory for each test - much slower")LowLevelRetries = flag.Int("low-level-retries", 10, "Number of low level retries")UseListR = flag.Bool("fast-list", false, "Use recursive list if available. Uses more memory but fewer transactions.")+ // SizeLimit signals tests to skip maximum test file size and skip inappropriate runs+ SizeLimit = flag.Int64("size-limit", 0, "Limit maximum test file size")// ListRetries is the number of times to retry a listing to overcome eventual consistencyListRetries = flag.Int("list-retries", 6, "Number or times to retry listing")// MatchTestRemote matches the remote names used for testingdiff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex 80983a777..2505473d6 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -557,9 +557,14 @@ func Run(t *testing.T, opt *Opt) {t.Run("FsPutError", func(t *testing.T) {skipIfNotOk(t)- const N = 5 * 1024+ var N int64 = 5 * 1024+ if *fstest.SizeLimit > 0 && N > *fstest.SizeLimit {+ N = *fstest.SizeLimit+ t.Logf("Reduce file size due to limit %d", N)+ }+// Read N bytes then produce an error- contents := random.String(N)+ contents := random.String(int(N))buf := bytes.NewBufferString(contents)er := &errorReader{errors.New("potato")}in := io.MultiReader(buf, er)diff --git a/fstest/test_all/config.go b/fstest/test_all/config.goindex 2fe0b7a6f..2f365987d 100644--- a/fstest/test_all/config.go+++ b/fstest/test_all/config.go@@ -34,6 +34,7 @@ type Backend struct {FastList bool // set to test with -fast-listShort bool // set to test with -shortOneOnly bool // set to run only one backend test at once+ MaxFile string // file size limitIgnore []string // test names to ignore the failure ofTests []string // paths of tests to run, blank for all}@@ -60,6 +61,12 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) {if !b.includeTest(t) {return runs}+ maxSize := fs.SizeSuffix(0)+ if b.MaxFile != "" {+ if err := maxSize.Set(b.MaxFile); err != nil {+ log.Printf("Invalid maxfile value %q: %v", b.MaxFile, err)+ }+ }fastlists := []bool{false}if b.FastList && t.FastList {fastlists = append(fastlists, true)@@ -81,6 +88,7 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) {NoRetries: t.NoRetries,OneOnly: b.OneOnly,NoBinary: t.NoBinary,+ SizeLimit: int64(maxSize),Ignore: ignore,}if t.AddBackend {diff --git a/fstest/test_all/run.go b/fstest/test_all/run.goindex 45ddb973b..bc684553b 100644--- a/fstest/test_all/run.go+++ b/fstest/test_all/run.go@@ -16,6 +16,7 @@ import ("regexp""runtime""sort"+ "strconv""strings""sync""time"@@ -43,6 +44,7 @@ type Run struct {NoRetries bool // don't retry if setOneOnly bool // only run test for this backend at onceNoBinary bool // set to not build a binary+ SizeLimit int64 // maximum test file sizeIgnore map[string]struct{}// InternalscmdLine []string@@ -339,6 +341,9 @@ func (r *Run) Init() {if r.Short {r.cmdLine = append(r.cmdLine, "-short")}+ if r.SizeLimit > 0 {+ r.cmdLine = append(r.cmdLine, "-size-limit", strconv.FormatInt(r.SizeLimit, 10))+ }r.cmdString = toShell(r.cmdLine)}