(t *testing.T)
| 1630 | } |
| 1631 | |
| 1632 | func TestSyncWithTrackRenamesStrategyModtime(t *testing.T) { |
| 1633 | ctx := context.Background() |
| 1634 | ctx, ci := fs.AddConfig(ctx) |
| 1635 | r := fstest.NewRun(t) |
| 1636 | |
| 1637 | ci.TrackRenames = true |
| 1638 | ci.TrackRenamesStrategy = "modtime" |
| 1639 | |
| 1640 | canTrackRenames := operations.CanServerSideMove(r.Fremote) && r.Fremote.Precision() != fs.ModTimeNotSupported |
| 1641 | t.Logf("Can track renames: %v", canTrackRenames) |
| 1642 | |
| 1643 | f1 := r.WriteFile("potato", "Potato Content", t1) |
| 1644 | f2 := r.WriteFile("yam", "Yam Content", t2) |
| 1645 | |
| 1646 | accounting.GlobalStats().ResetCounters() |
| 1647 | ctx = predictDstFromLogger(ctx) |
| 1648 | require.NoError(t, Sync(ctx, r.Fremote, r.Flocal, false)) |
| 1649 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 1650 | |
| 1651 | r.CheckRemoteItems(t, f1, f2) |
| 1652 | r.CheckLocalItems(t, f1, f2) |
| 1653 | |
| 1654 | // Now rename locally. |
| 1655 | f2 = r.RenameFile(f2, "yaml") |
| 1656 | |
| 1657 | accounting.GlobalStats().ResetCounters() |
| 1658 | ctx = predictDstFromLogger(ctx) |
| 1659 | require.NoError(t, Sync(ctx, r.Fremote, r.Flocal, false)) |
| 1660 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 1661 | |
| 1662 | r.CheckRemoteItems(t, f1, f2) |
| 1663 | |
| 1664 | // Check we renamed something if we should have |
| 1665 | if canTrackRenames { |
| 1666 | renames := accounting.GlobalStats().Renames(0) |
| 1667 | assert.Equal(t, canTrackRenames, renames != 0, fmt.Sprintf("canTrackRenames=%v, renames=%d", canTrackRenames, renames)) |
| 1668 | } |
| 1669 | } |
| 1670 | |
| 1671 | func TestSyncWithTrackRenamesStrategyLeaf(t *testing.T) { |
| 1672 | ctx := context.Background() |
nothing calls this directly
no test coverage detected
searching dependent graphs…