Test that --no-update-dir-modtime is working
(t *testing.T)
| 433 | |
| 434 | // Test that --no-update-dir-modtime is working |
| 435 | func 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 |
| 474 | func TestMoveNoEmptyDirectories(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…