mirror of
https://github.com/rclone/rclone.git
synced 2025-01-11 08:49:37 +01:00
sync: make --track-renames tests only check rename count if expecting renames
This commit is contained in:
parent
5f9be3dd05
commit
b2c9ef23fa
@ -1067,10 +1067,12 @@ func TestSyncWithTrackRenames(t *testing.T) {
|
|||||||
|
|
||||||
fstest.CheckItems(t, r.Fremote, f1, f2)
|
fstest.CheckItems(t, r.Fremote, f1, f2)
|
||||||
|
|
||||||
// Check we renamed something
|
// Check we renamed something if we should have
|
||||||
|
if canTrackRenames {
|
||||||
renames := accounting.GlobalStats().Renames(0)
|
renames := accounting.GlobalStats().Renames(0)
|
||||||
assert.Equal(t, canTrackRenames, renames != 0, fmt.Sprintf("canTrackRenames=%v, renames=%d", canTrackRenames, renames))
|
assert.Equal(t, canTrackRenames, renames != 0, fmt.Sprintf("canTrackRenames=%v, renames=%d", canTrackRenames, renames))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestParseRenamesStrategyModtime(t *testing.T) {
|
func TestParseRenamesStrategyModtime(t *testing.T) {
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
@ -1136,10 +1138,12 @@ func TestSyncWithTrackRenamesStrategyModtime(t *testing.T) {
|
|||||||
|
|
||||||
fstest.CheckItems(t, r.Fremote, f1, f2)
|
fstest.CheckItems(t, r.Fremote, f1, f2)
|
||||||
|
|
||||||
// Check we renamed something
|
// Check we renamed something if we should have
|
||||||
|
if canTrackRenames {
|
||||||
renames := accounting.GlobalStats().Renames(0)
|
renames := accounting.GlobalStats().Renames(0)
|
||||||
assert.Equal(t, canTrackRenames, renames != 0, fmt.Sprintf("canTrackRenames=%v, renames=%d", canTrackRenames, renames))
|
assert.Equal(t, canTrackRenames, renames != 0, fmt.Sprintf("canTrackRenames=%v, renames=%d", canTrackRenames, renames))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func toyFileTransfers(r *fstest.Run) int64 {
|
func toyFileTransfers(r *fstest.Run) int64 {
|
||||||
remote := r.Fremote.Name()
|
remote := r.Fremote.Name()
|
||||||
|
Loading…
Reference in New Issue
Block a user