Test server-side moving a file over itself
(t *testing.T)
| 690 | |
| 691 | // Test server-side moving a file over itself |
| 692 | func TestServerSideMoveOverSelf(t *testing.T) { |
| 693 | ctx := context.Background() |
| 694 | r := fstest.NewRun(t) |
| 695 | file1 := r.WriteObject(ctx, "sub dir/hello world", "hello world", t1) |
| 696 | r.CheckRemoteItems(t, file1) |
| 697 | |
| 698 | FremoteCopy, _, finaliseCopy, err := fstest.RandomRemote() |
| 699 | require.NoError(t, err) |
| 700 | defer finaliseCopy() |
| 701 | t.Logf("Server side copy (if possible) %v -> %v", r.Fremote, FremoteCopy) |
| 702 | |
| 703 | ctx = predictDstFromLogger(ctx) |
| 704 | err = CopyDir(ctx, FremoteCopy, r.Fremote, false) |
| 705 | require.NoError(t, err) |
| 706 | testLoggerVsLsf(ctx, FremoteCopy, r.Fremote, operations.GetLoggerOpt(ctx).JSON, t) |
| 707 | fstest.CheckItems(t, FremoteCopy, file1) |
| 708 | |
| 709 | file2 := r.WriteObject(ctx, "sub dir/hello world", "hello world again", t2) |
| 710 | r.CheckRemoteItems(t, file2) |
| 711 | |
| 712 | // ctx = predictDstFromLogger(ctx) |
| 713 | err = MoveDir(ctx, FremoteCopy, r.Fremote, false, false) |
| 714 | require.NoError(t, err) |
| 715 | // testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) // not currently supported |
| 716 | r.CheckRemoteItems(t) |
| 717 | fstest.CheckItems(t, FremoteCopy, file2) |
| 718 | |
| 719 | // check that individual file moves also work without MoveDir |
| 720 | file3 := r.WriteObject(ctx, "sub dir/hello world", "hello world a third time", t3) |
| 721 | r.CheckRemoteItems(t, file3) |
| 722 | |
| 723 | ctx = predictDstFromLogger(ctx) |
| 724 | fs.Debugf(nil, "testing file moves") |
| 725 | err = moveDir(ctx, FremoteCopy, r.Fremote, false, false) |
| 726 | require.NoError(t, err) |
| 727 | testLoggerVsLsf(ctx, FremoteCopy, r.Fremote, operations.GetLoggerOpt(ctx).JSON, t) |
| 728 | r.CheckRemoteItems(t) |
| 729 | fstest.CheckItems(t, FremoteCopy, file3) |
| 730 | } |
| 731 | |
| 732 | // Check that if the local file doesn't exist when we copy it up, |
| 733 | // nothing happens to the remote file |
nothing calls this directly
no test coverage detected
searching dependent graphs…