MCPcopy
hub / github.com/rclone/rclone / TestSyncNoUpdateDirModtime

Function TestSyncNoUpdateDirModtime

fs/sync/sync_test.go:435–471  ·  view source on GitHub ↗

Test that --no-update-dir-modtime is working

(t *testing.T)

Source from the content-addressed store, hash-verified

433
434// Test that --no-update-dir-modtime is working
435func TestSyncNoUpdateDirModtime(t *testing.T) {
436 r := fstest.NewRun(t)
437 if r.Fremote.Features().DirSetModTime == nil {
438 t.Skip("Skipping test as backend does not support DirSetModTime")
439 }
440
441 ctx, ci := fs.AddConfig(context.Background())
442 ci.NoUpdateDirModTime = true
443 const name = "sub dir no update dir modtime"
444
445 // Set the modtime on name to something specific
446 _, err := operations.MkdirModTime(ctx, r.Flocal, name, t1)
447 require.NoError(t, err)
448
449 // Create the remote directory with the current time
450 require.NoError(t, r.Fremote.Mkdir(ctx, name))
451
452 // Read its modification time
453 wantT := fstest.NewDirectory(ctx, t, r.Fremote, name).ModTime(ctx)
454
455 ctx = predictDstFromLogger(ctx)
456 err = Sync(ctx, r.Fremote, r.Flocal, true)
457 require.NoError(t, err)
458 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
459
460 r.CheckRemoteListing(
461 t,
462 []fstest.Item{},
463 []string{
464 name,
465 },
466 )
467
468 // Read the new directory modification time - it should not have changed
469 gotT := fstest.NewDirectory(ctx, t, r.Fremote, name).ModTime(ctx)
470 fstest.AssertTimeEqualWithPrecision(t, name, wantT, gotT, r.Fremote.Precision())
471}
472
473// Test move empty directories when we are not configured to create them
474func TestMoveNoEmptyDirectories(t *testing.T) {

Callers

nothing calls this directly

Calls 14

CheckRemoteListingMethod · 0.95
NewRunFunction · 0.92
AddConfigFunction · 0.92
MkdirModTimeFunction · 0.92
NewDirectoryFunction · 0.92
GetLoggerOptFunction · 0.92
predictDstFromLoggerFunction · 0.85
SyncFunction · 0.85
testLoggerVsLsfFunction · 0.85
FeaturesMethod · 0.65
MkdirMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…