(t *testing.T)
| 1669 | } |
| 1670 | |
| 1671 | func TestSyncWithTrackRenamesStrategyLeaf(t *testing.T) { |
| 1672 | ctx := context.Background() |
| 1673 | ctx, ci := fs.AddConfig(ctx) |
| 1674 | r := fstest.NewRun(t) |
| 1675 | |
| 1676 | ci.TrackRenames = true |
| 1677 | ci.TrackRenamesStrategy = "leaf" |
| 1678 | |
| 1679 | canTrackRenames := operations.CanServerSideMove(r.Fremote) && r.Fremote.Precision() != fs.ModTimeNotSupported |
| 1680 | t.Logf("Can track renames: %v", canTrackRenames) |
| 1681 | |
| 1682 | f1 := r.WriteFile("potato", "Potato Content", t1) |
| 1683 | f2 := r.WriteFile("sub/yam", "Yam Content", t2) |
| 1684 | |
| 1685 | accounting.GlobalStats().ResetCounters() |
| 1686 | ctx = predictDstFromLogger(ctx) |
| 1687 | require.NoError(t, Sync(ctx, r.Fremote, r.Flocal, false)) |
| 1688 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 1689 | |
| 1690 | r.CheckRemoteItems(t, f1, f2) |
| 1691 | r.CheckLocalItems(t, f1, f2) |
| 1692 | |
| 1693 | // Now rename locally. |
| 1694 | f2 = r.RenameFile(f2, "yam") |
| 1695 | |
| 1696 | accounting.GlobalStats().ResetCounters() |
| 1697 | ctx = predictDstFromLogger(ctx) |
| 1698 | require.NoError(t, Sync(ctx, r.Fremote, r.Flocal, false)) |
| 1699 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 1700 | |
| 1701 | r.CheckRemoteItems(t, f1, f2) |
| 1702 | |
| 1703 | // Check we renamed something if we should have |
| 1704 | if canTrackRenames { |
| 1705 | renames := accounting.GlobalStats().Renames(0) |
| 1706 | assert.Equal(t, canTrackRenames, renames != 0, fmt.Sprintf("canTrackRenames=%v, renames=%d", canTrackRenames, renames)) |
| 1707 | } |
| 1708 | } |
| 1709 | |
| 1710 | func toyFileTransfers(r *fstest.Run) int64 { |
| 1711 | remote := r.Fremote.Name() |
nothing calls this directly
no test coverage detected
searching dependent graphs…