mirror of
https://github.com/rclone/rclone.git
synced 2025-02-20 07:48:33 +02:00
operations: fix TestCopyFileMaxTransfer test to not be quite so fussy
This commit is contained in:
parent
3ea1c5c4d2
commit
257607ab3d
@ -38,7 +38,6 @@ import (
|
|||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
"github.com/rclone/rclone/fs/accounting"
|
"github.com/rclone/rclone/fs/accounting"
|
||||||
"github.com/rclone/rclone/fs/filter"
|
"github.com/rclone/rclone/fs/filter"
|
||||||
"github.com/rclone/rclone/fs/fserrors"
|
|
||||||
"github.com/rclone/rclone/fs/fshttp"
|
"github.com/rclone/rclone/fs/fshttp"
|
||||||
"github.com/rclone/rclone/fs/hash"
|
"github.com/rclone/rclone/fs/hash"
|
||||||
"github.com/rclone/rclone/fs/operations"
|
"github.com/rclone/rclone/fs/operations"
|
||||||
@ -1919,8 +1918,13 @@ func TestCopyFileMaxTransfer(t *testing.T) {
|
|||||||
accounting.Stats(ctx).ResetCounters()
|
accounting.Stats(ctx).ResetCounters()
|
||||||
err = operations.CopyFile(ctx, r.Fremote, r.Flocal, file2.Path, file2.Path)
|
err = operations.CopyFile(ctx, r.Fremote, r.Flocal, file2.Path, file2.Path)
|
||||||
require.NotNil(t, err, "Did not get expected max transfer limit error")
|
require.NotNil(t, err, "Did not get expected max transfer limit error")
|
||||||
|
if !errors.Is(err, accounting.ErrorMaxTransferLimitReachedFatal) {
|
||||||
|
t.Log("Expecting error to contain accounting.ErrorMaxTransferLimitReachedFatal")
|
||||||
|
// Sometimes the backends or their SDKs don't pass the
|
||||||
|
// error through properly, so check that it at least
|
||||||
|
// has the text we expect in.
|
||||||
assert.Contains(t, err.Error(), "max transfer limit reached")
|
assert.Contains(t, err.Error(), "max transfer limit reached")
|
||||||
assert.True(t, fserrors.IsFatalError(err), fmt.Sprintf("Not fatal error: %v: %#v:", err, err))
|
}
|
||||||
r.CheckLocalItems(t, file1, file2, file3, file4)
|
r.CheckLocalItems(t, file1, file2, file3, file4)
|
||||||
r.CheckRemoteItems(t, file1)
|
r.CheckRemoteItems(t, file1)
|
||||||
|
|
||||||
@ -1931,8 +1935,7 @@ func TestCopyFileMaxTransfer(t *testing.T) {
|
|||||||
accounting.Stats(ctx).ResetCounters()
|
accounting.Stats(ctx).ResetCounters()
|
||||||
err = operations.CopyFile(ctx, r.Fremote, r.Flocal, file3.Path, file3.Path)
|
err = operations.CopyFile(ctx, r.Fremote, r.Flocal, file3.Path, file3.Path)
|
||||||
require.NotNil(t, err)
|
require.NotNil(t, err)
|
||||||
assert.Contains(t, err.Error(), "max transfer limit reached")
|
assert.True(t, errors.Is(err, accounting.ErrorMaxTransferLimitReachedGraceful))
|
||||||
assert.True(t, fserrors.IsNoRetryError(err))
|
|
||||||
r.CheckLocalItems(t, file1, file2, file3, file4)
|
r.CheckLocalItems(t, file1, file2, file3, file4)
|
||||||
r.CheckRemoteItems(t, file1)
|
r.CheckRemoteItems(t, file1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user