Create a file and sync it. Change the last modified date and resync. If we're only doing sync by size and checksum, we expect nothing to to be transferred on the second sync.
(t *testing.T)
| 770 | // If we're only doing sync by size and checksum, we expect nothing to |
| 771 | // to be transferred on the second sync. |
| 772 | func TestSyncBasedOnCheckSum(t *testing.T) { |
| 773 | ctx := context.Background() |
| 774 | ctx, ci := fs.AddConfig(ctx) |
| 775 | r := fstest.NewRun(t) |
| 776 | ci.CheckSum = true |
| 777 | |
| 778 | file1 := r.WriteFile("check sum", "-", t1) |
| 779 | r.CheckLocalItems(t, file1) |
| 780 | |
| 781 | accounting.GlobalStats().ResetCounters() |
| 782 | ctx = predictDstFromLogger(ctx) |
| 783 | err := Sync(ctx, r.Fremote, r.Flocal, false) |
| 784 | require.NoError(t, err) |
| 785 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 786 | |
| 787 | // We should have transferred exactly one file. |
| 788 | assert.Equal(t, toyFileTransfers(r), accounting.GlobalStats().GetTransfers()) |
| 789 | r.CheckRemoteItems(t, file1) |
| 790 | |
| 791 | // Change last modified date only |
| 792 | file2 := r.WriteFile("check sum", "-", t2) |
| 793 | r.CheckLocalItems(t, file2) |
| 794 | |
| 795 | accounting.GlobalStats().ResetCounters() |
| 796 | ctx = predictDstFromLogger(ctx) |
| 797 | err = Sync(ctx, r.Fremote, r.Flocal, false) |
| 798 | require.NoError(t, err) |
| 799 | testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t) |
| 800 | |
| 801 | // We should have transferred no files |
| 802 | assert.Equal(t, int64(0), accounting.GlobalStats().GetTransfers()) |
| 803 | r.CheckLocalItems(t, file2) |
| 804 | r.CheckRemoteItems(t, file1) |
| 805 | } |
| 806 | |
| 807 | // Create a file and sync it. Change the last modified date and the |
| 808 | // file contents but not the size. If we're only doing sync by size |
nothing calls this directly
no test coverage detected
searching dependent graphs…