MCPcopy
hub / github.com/rclone/rclone / TestServerSideCopy

Function TestServerSideCopy

fs/sync/sync_test.go:611–628  ·  view source on GitHub ↗

Test a server-side copy if possible, or the backup path if not

(t *testing.T)

Source from the content-addressed store, hash-verified

609
610// Test a server-side copy if possible, or the backup path if not
611func TestServerSideCopy(t *testing.T) {
612 ctx := context.Background()
613 r := fstest.NewRun(t)
614 file1 := r.WriteObject(ctx, "sub dir/hello world", "hello world", t1)
615 r.CheckRemoteItems(t, file1)
616
617 FremoteCopy, _, finaliseCopy, err := fstest.RandomRemote()
618 require.NoError(t, err)
619 defer finaliseCopy()
620 t.Logf("Server side copy (if possible) %v -> %v", r.Fremote, FremoteCopy)
621
622 ctx = predictDstFromLogger(ctx)
623 err = CopyDir(ctx, FremoteCopy, r.Fremote, false)
624 require.NoError(t, err)
625 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
626
627 fstest.CheckItems(t, FremoteCopy, file1)
628}
629
630// Test copying a file over itself
631func TestCopyOverSelf(t *testing.T) {

Callers

nothing calls this directly

Calls 10

WriteObjectMethod · 0.95
CheckRemoteItemsMethod · 0.95
NewRunFunction · 0.92
RandomRemoteFunction · 0.92
GetLoggerOptFunction · 0.92
CheckItemsFunction · 0.92
predictDstFromLoggerFunction · 0.85
testLoggerVsLsfFunction · 0.85
LogfMethod · 0.80
CopyDirFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…