mirror of
https://github.com/rclone/rclone
synced 2024-12-22 13:03:02 +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
|
||||
// So check it more manually
|
||||
got := fstest.NewDirectory(ctx, t, r.Fremote, "sub dir")
|
||||
gotT := got.ModTime(ctx)
|
||||
fstest.AssertTimeEqualWithPrecision(t, subDir.Remote(), subDirT, gotT, fs.GetModifyWindow(ctx, r.Fremote, r.Flocal))
|
||||
fstest.CheckDirModTime(ctx, t, r.Fremote, got, subDirT)
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
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 {
|
||||
wantT := NewDirectory(ctx, t, r.Flocal, name).ModTime(ctx)
|
||||
got := NewDirectory(ctx, t, r.Fremote, name)
|
||||
gotT := got.ModTime(ctx)
|
||||
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))
|
||||
CheckDirModTime(ctx, t, r.Fremote, got, wantT)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user