mirror of
https://github.com/rclone/rclone.git
synced 2026-10-10 06:55:45 -04:00
operations: fix TestDeleteFatalError, TestDirMoveMoveError and TestDirMoveContext on remotes
TestDeleteFatalError set --max-delete before writing its files, so on chunker, which deletes while uploading, the setup failed. TestDirMoveMoveError and TestDirMoveContext test the core DirMove logic with a wrapping Fs. This fails on remotes without Move (eg s3, memory) and on those whose objects don't belong to the wrapped Fs (eg archive), so they now only run on local.
This commit is contained in:
1 parent
1e92520076
commit
ff958c999f
1 file changed
+7
-1
@@ -433,12 +433,13 @@ func TestDeleteFatalError(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx, ci := fs.AddConfig(ctx)
|
||||
ci.Checkers = 2
|
||||
ci.MaxDelete = 1
|
||||
r := fstest.NewRun(t)
|
||||
// More files than the deleters' channel can hold
|
||||
for i := range 20 {
|
||||
r.WriteObject(ctx, fmt.Sprintf("file%d", i), "x", t1)
|
||||
}
|
||||
// Set after writing the files as some backends (eg chunker) delete while uploading
|
||||
ci.MaxDelete = 1
|
||||
|
||||
done := make(chan error, 1)
|
||||
go func() {
|
||||
@@ -1483,6 +1484,11 @@ type noDirMoveFs struct {
|
||||
func (f *noDirMoveFs) Features() *fs.Features { return f.features }
|
||||
|
||||
func newNoDirMoveFs(t *testing.T, wrapped fs.Fs, failOn string) *noDirMoveFs {
|
||||
// This tests the core DirMove logic, and on other backends the
|
||||
// objects may not belong to wrapped or there may be no Move.
|
||||
if *fstest.RemoteName != "" {
|
||||
t.Skip("Skipping test on non local remote")
|
||||
}
|
||||
move := wrapped.Features().Move
|
||||
require.NotNil(t, move, "the test needs a backend with Move")
|
||||
f := &noDirMoveFs{
|
||||
|
||||
Reference in new issue
Block a user