MCPcopy
hub / github.com/rclone/rclone / TestRunTwice

Function TestRunTwice

fs/sync/sync_transform_test.go:337–361  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

335}
336
337func TestRunTwice(t *testing.T) {
338 ctx := context.Background()
339 r := fstest.NewRun(t)
340 err := transform.SetOptions(ctx, "dir,prefix=tac", "dir,prefix=tic")
341 require.NoError(t, err)
342 file1 := r.WriteFile("toe/toe/toe.txt", "hello world", t1)
343
344 r.Mkdir(ctx, r.Fremote)
345 ctx = predictDstFromLogger(ctx)
346 err = Sync(ctx, r.Fremote, r.Flocal, true)
347 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
348 require.NoError(t, err)
349
350 r.CheckLocalItems(t, file1)
351 r.CheckRemoteItems(t, fstest.NewItem("tictactoe/tictactoe/toe.txt", "hello world", t1))
352
353 // result should not change second time, since src is unchanged
354 ctx = predictDstFromLogger(ctx)
355 err = Sync(ctx, r.Fremote, r.Flocal, true)
356 testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
357 require.NoError(t, err)
358
359 r.CheckLocalItems(t, file1)
360 r.CheckRemoteItems(t, fstest.NewItem("tictactoe/tictactoe/toe.txt", "hello world", t1))
361}
362
363func TestSyntax(t *testing.T) {
364 ctx := context.Background()

Callers

nothing calls this directly

Calls 11

WriteFileMethod · 0.95
MkdirMethod · 0.95
CheckLocalItemsMethod · 0.95
CheckRemoteItemsMethod · 0.95
NewRunFunction · 0.92
SetOptionsFunction · 0.92
GetLoggerOptFunction · 0.92
NewItemFunction · 0.92
predictDstFromLoggerFunction · 0.85
SyncFunction · 0.85
testLoggerVsLsfFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…