MCPcopy
hub / github.com/rclone/rclone / checkPreReqs

Method checkPreReqs

cmd/bisync/bisync_test.go:974–1101  ·  view source on GitHub ↗
(ctx context.Context, opt *bisync.Options)

Source from the content-addressed store, hash-verified

972}
973
974func (b *bisyncTest) checkPreReqs(ctx context.Context, opt *bisync.Options) (context.Context, *bisync.Options) {
975 // check pre-requisites
976 if b.testCase == "backupdir" && !(b.fs1.Features().IsLocal && b.fs2.Features().IsLocal) {
977 b.t.Skip("backupdir test currently only works on local (it uses the workdir)")
978 }
979 if b.testCase == "volatile" && !(b.fs1.Features().IsLocal && b.fs2.Features().IsLocal) {
980 b.t.Skip("skipping 'volatile' test on non-local as it requires uploading 100 files")
981 }
982 if strings.HasPrefix(b.fs1.String(), "Dropbox") || strings.HasPrefix(b.fs2.String(), "Dropbox") {
983 fs.GetConfig(ctx).RefreshTimes = true // https://rclone.org/bisync/#notes-about-testing
984 }
985 if strings.HasPrefix(b.fs1.String(), "Dropbox") {
986 b.fs1.Features().Disable("Copy") // https://github.com/rclone/rclone/issues/6199#issuecomment-1570366202
987 }
988 if strings.HasPrefix(b.fs2.String(), "Dropbox") {
989 b.fs2.Features().Disable("Copy") // https://github.com/rclone/rclone/issues/6199#issuecomment-1570366202
990 }
991 if strings.HasPrefix(b.fs1.String(), "OneDrive") {
992 b.fs1.Features().Disable("Copy") // API has longstanding bug for conflictBehavior=replace https://github.com/rclone/rclone/issues/4590
993 b.fs1.Features().Disable("Move")
994 }
995 if strings.HasPrefix(b.fs2.String(), "OneDrive") {
996 b.fs2.Features().Disable("Copy") // API has longstanding bug for conflictBehavior=replace https://github.com/rclone/rclone/issues/4590
997 b.fs2.Features().Disable("Move")
998 }
999 if strings.HasPrefix(b.fs1.String(), "sftp") {
1000 b.fs1.Features().Disable("Copy") // disable --sftp-copy-is-hardlink as hardlinks are not truly copies
1001 }
1002 if strings.HasPrefix(b.fs2.String(), "sftp") {
1003 b.fs2.Features().Disable("Copy") // disable --sftp-copy-is-hardlink as hardlinks are not truly copies
1004 }
1005 if strings.Contains(strings.ToLower(fs.ConfigString(b.fs1)), "mailru") || strings.Contains(strings.ToLower(fs.ConfigString(b.fs2)), "mailru") {
1006 fs.GetConfig(ctx).TPSLimit = 10 // https://github.com/rclone/rclone/issues/7768#issuecomment-2060888980
1007 }
1008 if (!b.fs1.Features().CanHaveEmptyDirectories || !b.fs2.Features().CanHaveEmptyDirectories) && (b.testCase == "createemptysrcdirs" || b.testCase == "rmdirs") {
1009 b.t.Skip("skipping test as remote does not support empty dirs")
1010 }
1011 ignoreHashBackends := []string{"TestWebdavNextcloud", "TestWebdavOwncloud", "TestAzureFiles"} // backends that support hashes but allow them to be blank
1012 if slices.ContainsFunc(ignoreHashBackends, func(prefix string) bool { return strings.HasPrefix(b.fs1.Name(), prefix) }) || slices.ContainsFunc(ignoreHashBackends, func(prefix string) bool { return strings.HasPrefix(b.fs2.Name(), prefix) }) {
1013 b.ignoreBlankHash = true
1014 }
1015 if b.fs1.Precision() == fs.ModTimeNotSupported || b.fs2.Precision() == fs.ModTimeNotSupported {
1016 if b.testCase != "nomodtime" {
1017 b.t.Skip("skipping test as at least one remote does not support setting modtime")
1018 }
1019 b.ignoreModtime = true
1020 }
1021 // test if modtimes are writeable
1022 testSetModtime := func(f fs.Fs) {
1023 ctx := accounting.WithStatsGroup(ctx, random.String(8)) // keep stats separate
1024 in := bytes.NewBufferString("modtime_write_test")
1025 objinfo := object.NewStaticObjectInfo("modtime_write_test", initDate, int64(len("modtime_write_test")), true, nil, nil)
1026 obj, err := f.Put(ctx, in, objinfo)
1027 require.NoError(b.t, err)
1028 if !f.Features().IsLocal {
1029 time.Sleep(time.Second) // avoid GoogleCloudStorage Error 429 rateLimitExceeded
1030 }
1031 err = obj.SetModTime(ctx, initDate)

Callers 1

runBisyncMethod · 0.95

Calls 15

GetConfigFunction · 0.92
ConfigStringFunction · 0.92
WithStatsGroupFunction · 0.92
StringFunction · 0.92
NewStaticObjectInfoFunction · 0.92
GetFunction · 0.92
AddConfigFunction · 0.92
CopyFunction · 0.92
splitLineFunction · 0.85
DisableMethod · 0.80
ContainsMethod · 0.80
LogfMethod · 0.80

Tested by

no test coverage detected