MCPcopy
hub / github.com/rclone/rclone / RandomRemote

Function RandomRemote

fstest/fstest.go:455–481  ·  view source on GitHub ↗

RandomRemote makes a random bucket or subdirectory on the remote from the -remote parameter Call the finalise function returned to Purge the fs at the end (and the parent if necessary) Returns the remote, its url, a finaliser and an error

()

Source from the content-addressed store, hash-verified

453//
454// Returns the remote, its url, a finaliser and an error
455func RandomRemote() (fs.Fs, string, func(), error) {
456 var err error
457 var parentRemote fs.Fs
458 remoteName := *RemoteName
459
460 remoteName, _, err = RandomRemoteName(remoteName)
461 if err != nil {
462 return nil, "", nil, err
463 }
464
465 remote, err := fs.NewFs(context.Background(), remoteName)
466 if err != nil {
467 return nil, "", nil, err
468 }
469
470 finalise := func() {
471 Purge(remote)
472 if parentRemote != nil {
473 Purge(parentRemote)
474 if err != nil {
475 fs.Logf(nil, "Failed to purge %v: %v", parentRemote, err)
476 }
477 }
478 }
479
480 return remote, remoteName, finalise, nil
481}
482
483// Purge is a simplified re-implementation of operations.Purge for the
484// test routine cleanup to avoid circular dependencies.

Callers 13

newRunFunction · 0.92
runFunction · 0.92
TestResticIntegrationFunction · 0.92
TestBisyncRemoteLocalFunction · 0.92
TestBisyncLocalRemoteFunction · 0.92
TestBisyncRemoteRemoteFunction · 0.92
RunFunction · 0.92
TestServerSideCopyFunction · 0.92
testServerSideMoveFunction · 0.92

Calls 4

NewFsFunction · 0.92
LogfFunction · 0.92
RandomRemoteNameFunction · 0.85
PurgeFunction · 0.70

Tested by 9

TestResticIntegrationFunction · 0.74
TestBisyncRemoteLocalFunction · 0.74
TestBisyncLocalRemoteFunction · 0.74
TestBisyncRemoteRemoteFunction · 0.74
TestServerSideCopyFunction · 0.74
testServerSideMoveFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…