forked from TrueCloudLab/rclone
fstest: implement method to skip ChunkedCopy tests
This commit is contained in:
parent
0470450583
commit
a1f52bcf50
2 changed files with 15 additions and 4 deletions
|
@ -3091,6 +3091,9 @@ func (f *Fs) setUploadCutoff(cs fs.SizeSuffix) (old fs.SizeSuffix, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Fs) setCopyCutoff(cs fs.SizeSuffix) (old fs.SizeSuffix, err error) {
|
func (f *Fs) setCopyCutoff(cs fs.SizeSuffix) (old fs.SizeSuffix, err error) {
|
||||||
|
if f.opt.CopyCutoff == math.MaxInt64 {
|
||||||
|
return f.opt.CopyCutoff, fmt.Errorf("--s3-copy-cutoff not supported: %w", fs.ErrorNotImplemented)
|
||||||
|
}
|
||||||
err = checkUploadChunkSize(cs)
|
err = checkUploadChunkSize(cs)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
old, f.opt.CopyCutoff = f.opt.CopyCutoff, cs
|
old, f.opt.CopyCutoff = f.opt.CopyCutoff, cs
|
||||||
|
@ -3234,6 +3237,10 @@ func setQuirks(opt *Options) {
|
||||||
useMultipartEtag = false
|
useMultipartEtag = false
|
||||||
useAlreadyExists = false
|
useAlreadyExists = false
|
||||||
// useMultipartUploads = false - set this manually
|
// useMultipartUploads = false - set this manually
|
||||||
|
// rclone serve doesn't support multi-part server side copy:
|
||||||
|
// See: https://github.com/rclone/rclone/issues/7454
|
||||||
|
// So make cutoff very large which it does support
|
||||||
|
opt.CopyCutoff = math.MaxInt64
|
||||||
case "Scaleway":
|
case "Scaleway":
|
||||||
// Scaleway can only have 1000 parts in an upload
|
// Scaleway can only have 1000 parts in an upload
|
||||||
if opt.MaxUploadParts > 1000 {
|
if opt.MaxUploadParts > 1000 {
|
||||||
|
|
|
@ -83,6 +83,7 @@ type SetUploadCutoffer interface {
|
||||||
type SetCopyCutoffer interface {
|
type SetCopyCutoffer interface {
|
||||||
// Change the configured CopyCutoff.
|
// Change the configured CopyCutoff.
|
||||||
// Will only be called while no transfer is in progress.
|
// Will only be called while no transfer is in progress.
|
||||||
|
// Return fs.ErrorNotImplemented if you can't implement this
|
||||||
SetCopyCutoff(fs.SizeSuffix) (fs.SizeSuffix, error)
|
SetCopyCutoff(fs.SizeSuffix) (fs.SizeSuffix, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,10 +2346,6 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
t.Skip("skipping as ChunkedUpload.Skip is set")
|
t.Skip("skipping as ChunkedUpload.Skip is set")
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(f.Name(), "serves3") || strings.HasPrefix(f.Name(), "TestS3Rclone") {
|
|
||||||
t.Skip("FIXME skip test - see #7454")
|
|
||||||
}
|
|
||||||
|
|
||||||
do, _ := f.(SetCopyCutoffer)
|
do, _ := f.(SetCopyCutoffer)
|
||||||
if do == nil {
|
if do == nil {
|
||||||
t.Skipf("%T does not implement SetCopyCutoff", f)
|
t.Skipf("%T does not implement SetCopyCutoff", f)
|
||||||
|
@ -2362,6 +2359,13 @@ func Run(t *testing.T, opt *Opt) {
|
||||||
minChunkSize = opt.ChunkedUpload.CeilChunkSize(minChunkSize)
|
minChunkSize = opt.ChunkedUpload.CeilChunkSize(minChunkSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test setting the copy cutoff before we get going
|
||||||
|
_, err := do.SetCopyCutoff(minChunkSize)
|
||||||
|
if errors.Is(err, fs.ErrorNotImplemented) {
|
||||||
|
t.Skipf("%T does not support SetCopyCutoff: %v", f, err)
|
||||||
|
}
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
chunkSizes := fs.SizeSuffixList{
|
chunkSizes := fs.SizeSuffixList{
|
||||||
minChunkSize,
|
minChunkSize,
|
||||||
minChunkSize + 1,
|
minChunkSize + 1,
|
||||||
|
|
Loading…
Add table
Reference in a new issue