mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
sync: implement directory sync for mod times and metadata
Directory mod times are synced by default if the backend is capable and directory metadata is synced if the --metadata flag is provided and the backend is capable. This updates the bisync golden tests also which were affected by --dry-run setting of directory modtimes. Fixes #6685
This commit is contained in:
@@ -360,6 +360,22 @@ func (r *Run) CheckRemoteListing(t *testing.T, items []Item, expectedDirs []stri
|
||||
CheckListingWithPrecision(t, r.Fremote, items, expectedDirs, r.Precision)
|
||||
}
|
||||
|
||||
// CheckDirectoryModTimes checks that the directory names in r.Flocal has the correct modtime compared to r.Fremote
|
||||
func (r *Run) CheckDirectoryModTimes(t *testing.T, names ...string) {
|
||||
if r.Fremote.Features().DirSetModTime == nil && r.Fremote.Features().MkdirMetadata == nil {
|
||||
fs.Debugf(r.Fremote, "Skipping modtime test as remote does not support DirSetModTime or MkdirMetadata")
|
||||
return
|
||||
}
|
||||
ctx := context.Background()
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the temporary directory
|
||||
func (r *Run) cleanTempDir() {
|
||||
err := os.RemoveAll(r.LocalName)
|
||||
|
||||
Reference in New Issue
Block a user