MCPcopy
hub / github.com/rclone/rclone / TestSyncMultipleCompareDest

Function TestSyncMultipleCompareDest

fs/sync/sync_test.go:2227–2257  ·  view source on GitHub ↗

Test with multiple CompareDest

(t *testing.T)

Source from the content-addressed store, hash-verified

2225
2226// Test with multiple CompareDest
2227func TestSyncMultipleCompareDest(t *testing.T) {
2228 ctx := context.Background()
2229 ctx, ci := fs.AddConfig(ctx)
2230 r := fstest.NewRun(t)
2231 precision := fs.GetModifyWindow(ctx, r.Fremote, r.Flocal)
2232
2233 ci.CompareDest = []string{r.FremoteName + "/pre-dest1", r.FremoteName + "/pre-dest2"}
2234
2235 // check empty dest, new compare
2236 fsrc1 := r.WriteFile("1", "1", t1)
2237 fsrc2 := r.WriteFile("2", "2", t1)
2238 fsrc3 := r.WriteFile("3", "3", t1)
2239 r.CheckLocalItems(t, fsrc1, fsrc2, fsrc3)
2240
2241 fdest1 := r.WriteObject(ctx, "pre-dest1/1", "1", t1)
2242 fdest2 := r.WriteObject(ctx, "pre-dest2/2", "2", t1)
2243 r.CheckRemoteItems(t, fdest1, fdest2)
2244
2245 accounting.GlobalStats().ResetCounters()
2246 fdst, err := fs.NewFs(ctx, r.FremoteName+"/dest")
2247 require.NoError(t, err)
2248 // ctx = predictDstFromLogger(ctx)
2249 require.NoError(t, Sync(ctx, fdst, r.Flocal, false))
2250 // testLoggerVsLsf(ctx, fdst, operations.GetLoggerOpt(ctx).JSON, t)
2251
2252 fdest3 := fsrc3
2253 fdest3.Path = "dest/3"
2254
2255 fstest.CheckItemsWithPrecision(t, fdst, precision, fsrc3)
2256 r.CheckRemoteItems(t, fdest1, fdest2, fdest3)
2257}
2258
2259// Test with CopyDest set
2260func TestSyncCopyDest(t *testing.T) {

Callers

nothing calls this directly

Calls 12

WriteFileMethod · 0.95
CheckLocalItemsMethod · 0.95
WriteObjectMethod · 0.95
CheckRemoteItemsMethod · 0.95
AddConfigFunction · 0.92
NewRunFunction · 0.92
GetModifyWindowFunction · 0.92
GlobalStatsFunction · 0.92
NewFsFunction · 0.92
CheckItemsWithPrecisionFunction · 0.92
SyncFunction · 0.85
ResetCountersMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…