mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 09:32:29 +08: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/accounting"
|
||||
"github.com/rclone/rclone/fs/filter"
|
||||
"github.com/rclone/rclone/fs/fserrors"
|
||||
"github.com/rclone/rclone/fs/fshttp"
|
||||
"github.com/rclone/rclone/fs/hash"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
|
@ -1919,8 +1918,13 @@ func TestCopyFileMaxTransfer(t *testing.T) {
|
|||
accounting.Stats(ctx).ResetCounters()
|
||||
err = operations.CopyFile(ctx, r.Fremote, r.Flocal, file2.Path, file2.Path)
|
||||
require.NotNil(t, err, "Did not get expected max transfer limit error")
|
||||
assert.Contains(t, err.Error(), "max transfer limit reached")
|
||||
assert.True(t, fserrors.IsFatalError(err), fmt.Sprintf("Not fatal error: %v: %#v:", err, err))
|
||||
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")
|
||||
}
|
||||
r.CheckLocalItems(t, file1, file2, file3, file4)
|
||||
r.CheckRemoteItems(t, file1)
|
||||
|
||||
|
@ -1931,8 +1935,7 @@ func TestCopyFileMaxTransfer(t *testing.T) {
|
|||
accounting.Stats(ctx).ResetCounters()
|
||||
err = operations.CopyFile(ctx, r.Fremote, r.Flocal, file3.Path, file3.Path)
|
||||
require.NotNil(t, err)
|
||||
assert.Contains(t, err.Error(), "max transfer limit reached")
|
||||
assert.True(t, fserrors.IsNoRetryError(err))
|
||||
assert.True(t, errors.Is(err, accounting.ErrorMaxTransferLimitReachedGraceful))
|
||||
r.CheckLocalItems(t, file1, file2, file3, file4)
|
||||
r.CheckRemoteItems(t, file1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user