mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 09:04:52 +01:00
sync: fix TestMoveEmptyDirectories so they work on backends which don't support DirModTimes
This commit is contained in:
parent
6e28edeb9a
commit
be39e99918
@ -340,8 +340,7 @@ func TestMoveEmptyDirectories(t *testing.T) {
|
|||||||
// Note that "sub dir" mod time is updated when file1 is deleted from it
|
// Note that "sub dir" mod time is updated when file1 is deleted from it
|
||||||
// So check it more manually
|
// So check it more manually
|
||||||
got := fstest.NewDirectory(ctx, t, r.Fremote, "sub dir")
|
got := fstest.NewDirectory(ctx, t, r.Fremote, "sub dir")
|
||||||
gotT := got.ModTime(ctx)
|
fstest.CheckDirModTime(ctx, t, r.Fremote, got, subDirT)
|
||||||
fstest.AssertTimeEqualWithPrecision(t, subDir.Remote(), subDirT, gotT, fs.GetModifyWindow(ctx, r.Fremote, r.Flocal))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test sync empty directories
|
// Test sync empty directories
|
||||||
|
@ -602,6 +602,10 @@ func CheckEntryMetadata(ctx context.Context, t *testing.T, f fs.Fs, entry fs.Dir
|
|||||||
|
|
||||||
// CheckDirModTime checks the modtime on the directory
|
// CheckDirModTime checks the modtime on the directory
|
||||||
func CheckDirModTime(ctx context.Context, t *testing.T, f fs.Fs, dir fs.Directory, wantT time.Time) {
|
func CheckDirModTime(ctx context.Context, t *testing.T, f fs.Fs, dir fs.Directory, wantT time.Time) {
|
||||||
|
if f.Features().DirSetModTime == nil && f.Features().MkdirMetadata == nil {
|
||||||
|
fs.Debugf(f, "Skipping modtime test as remote does not support DirSetModTime or MkdirMetadata")
|
||||||
|
return
|
||||||
|
}
|
||||||
gotT := dir.ModTime(ctx)
|
gotT := dir.ModTime(ctx)
|
||||||
AssertTimeEqualWithPrecision(t, dir.Remote(), wantT, gotT, f.Precision())
|
AssertTimeEqualWithPrecision(t, dir.Remote(), wantT, gotT, f.Precision())
|
||||||
}
|
}
|
||||||
|
@ -370,9 +370,7 @@ func (r *Run) CheckDirectoryModTimes(t *testing.T, names ...string) {
|
|||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
wantT := NewDirectory(ctx, t, r.Flocal, name).ModTime(ctx)
|
wantT := NewDirectory(ctx, t, r.Flocal, name).ModTime(ctx)
|
||||||
got := NewDirectory(ctx, t, r.Fremote, name)
|
got := NewDirectory(ctx, t, r.Fremote, name)
|
||||||
gotT := got.ModTime(ctx)
|
CheckDirModTime(ctx, t, r.Fremote, got, wantT)
|
||||||
fs.Debugf(r.Fremote, "Testing directory mod time of %q: wantT=%v, gotT=%v", name, wantT, gotT)
|
|
||||||
AssertTimeEqualWithPrecision(t, got.Remote(), wantT, gotT, fs.GetModifyWindow(ctx, r.Fremote, r.Flocal))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user