"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fstest: remove -subdir flag as it no longer tests anything useful #3421
Nick Craig-Woodaf3c47d28215
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 3b266b7d1..8c470a4a6 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -118,7 +118,7 @@ but they can be run against any of the remotes.cd fs/syncgo test -v -remote TestDrive:- go test -v -remote TestDrive: -subdir+ go test -v -remote TestDrive: -fast-listcd fs/operationsgo test -v -remote TestDrive:@@ -362,9 +362,7 @@ Or if you want to run the integration tests manually:* `go test -v -remote TestRemote:`* `cd fs/sync`* `go test -v -remote TestRemote:`- * If you are making a bucket based remote, then check with this also- * `go test -v -remote TestRemote: -subdir`- * And if your remote defines `ListR` this also+ * If your remote defines `ListR` check with this also* `go test -v -remote TestRemote: -fast-list`See the [testing](#testing) section for more information on integration tests.diff --git a/cmd/mountlib/mounttest/fs.go b/cmd/mountlib/mounttest/fs.goindex 55df6f373..02eb1208b 100644--- a/cmd/mountlib/mounttest/fs.go+++ b/cmd/mountlib/mounttest/fs.go@@ -115,7 +115,7 @@ func newRun() *Run {fstest.Initialise()var err error- r.fremote, r.fremoteName, r.cleanRemote, err = fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ r.fremote, r.fremoteName, r.cleanRemote, err = fstest.RandomRemote()if err != nil {log.Fatalf("Failed to open remote %q: %v", *fstest.RemoteName, err)}diff --git a/cmd/serve/restic/restic_test.go b/cmd/serve/restic/restic_test.goindex 4139535c2..e18ed8d22 100644--- a/cmd/serve/restic/restic_test.go+++ b/cmd/serve/restic/restic_test.go@@ -35,7 +35,7 @@ func TestRestic(t *testing.T) {fstest.Initialise()- fremote, _, clean, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ fremote, _, clean, err := fstest.RandomRemote()assert.NoError(t, err)defer clean()diff --git a/cmd/serve/servetest/servetest.go b/cmd/serve/servetest/servetest.goindex 99cf33a32..1ef1497a9 100644--- a/cmd/serve/servetest/servetest.go+++ b/cmd/serve/servetest/servetest.go@@ -31,7 +31,7 @@ type StartFn func(f fs.Fs) (configmap.Simple, func())func run(t *testing.T, name string, start StartFn, useProxy bool) {fstest.Initialise()- fremote, _, clean, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ fremote, _, clean, err := fstest.RandomRemote()assert.NoError(t, err)defer clean()diff --git a/fs/sync/sync_test.go b/fs/sync/sync_test.goindex 85ee4f8d0..6ca25733a 100644--- a/fs/sync/sync_test.go+++ b/fs/sync/sync_test.go@@ -250,7 +250,7 @@ func TestServerSideCopy(t *testing.T) {file1 := r.WriteObject(context.Background(), "sub dir/hello world", "hello world", t1)fstest.CheckItems(t, r.Fremote, file1)- FremoteCopy, _, finaliseCopy, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ FremoteCopy, _, finaliseCopy, err := fstest.RandomRemote()require.NoError(t, err)defer finaliseCopy()t.Logf("Server side copy (if possible) %v -> %v", r.Fremote, FremoteCopy)@@ -1026,7 +1026,7 @@ func TestSyncWithTrackRenames(t *testing.T) {// Test a server side move if possible, or the backup path if notfunc testServerSideMove(t *testing.T, r *fstest.Run, withFilter, testDeleteEmptyDirs bool) {- FremoteMove, _, finaliseMove, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ FremoteMove, _, finaliseMove, err := fstest.RandomRemote()require.NoError(t, err)defer finaliseMove()@@ -1066,7 +1066,7 @@ func testServerSideMove(t *testing.T, r *fstest.Run, withFilter, testDeleteEmptyfstest.CheckItems(t, FremoteMove, file2, file1, file3u)// Create a new empty remote for stuff to be moved into- FremoteMove2, _, finaliseMove2, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ FremoteMove2, _, finaliseMove2, err := fstest.RandomRemote()require.NoError(t, err)defer finaliseMove2()diff --git a/fstest/fstest.go b/fstest/fstest.goindex 411b4c3cc..faf6a5134 100644--- a/fstest/fstest.go+++ b/fstest/fstest.go@@ -36,7 +36,6 @@ import (// Globalsvar (RemoteName = flag.String("remote", "", "Remote to test with, defaults to local filesystem")- SubDir = flag.Bool("subdir", false, "Set to test with a sub directory")Verbose = flag.Bool("verbose", false, "Set to enable logging")DumpHeaders = flag.Bool("dump-headers", false, "Set to dump headers (needs -verbose)")DumpBodies = flag.Bool("dump-bodies", false, "Set to dump bodies (needs -verbose)")@@ -439,28 +438,22 @@ func RandomRemoteName(remoteName string) (string, string, error) {}// 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-func RandomRemote(remoteName string, subdir bool) (fs.Fs, string, func(), error) {+func RandomRemote() (fs.Fs, string, func(), error) {var err errorvar parentRemote fs.Fs+ remoteName := *RemoteNameremoteName, _, err = RandomRemoteName(remoteName)if err != nil {return nil, "", nil, err}- if subdir {- parentRemote, err = fs.NewFs(remoteName)- if err != nil {- return nil, "", nil, err- }- remoteName += "/rclone-test-subdir-" + random.String(8)- }-remote, err := fs.NewFs(remoteName)if err != nil {return nil, "", nil, errdiff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex 3e5e48a55..40cb96a44 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -349,6 +349,7 @@ func Run(t *testing.T, opt *Opt) {if *fstest.RemoteName != "" {remoteName = *fstest.RemoteName}+ fstest.RemoteName = &remoteNamet.Logf("Using remote %q", remoteName)var err errorif remoteName == "" {@@ -1117,7 +1118,7 @@ func Run(t *testing.T, opt *Opt) {require.Equal(t, fs.ErrorDirExists, err)// new remote- newRemote, _, removeNewRemote, err := fstest.RandomRemote(remoteName, false)+ newRemote, _, removeNewRemote, err := fstest.RandomRemote()require.NoError(t, err)defer removeNewRemote()@@ -1422,7 +1423,7 @@ func Run(t *testing.T, opt *Opt) {require.NotEqual(t, "", link3, "Link should not be empty")// sharing the "root" directory in a subremote- subRemote, _, removeSubRemote, err := fstest.RandomRemote(remoteName, false)+ subRemote, _, removeSubRemote, err := fstest.RandomRemote()require.NoError(t, err)defer removeSubRemote()// ensure sub remote isn't emptydiff --git a/fstest/run.go b/fstest/run.goindex 507422b5b..042abc9a3 100644--- a/fstest/run.go+++ b/fstest/run.go@@ -90,7 +90,7 @@ func newRun() *Run {Initialise()var err error- r.Fremote, r.FremoteName, r.cleanRemote, err = RandomRemote(*RemoteName, *SubDir)+ r.Fremote, r.FremoteName, r.cleanRemote, err = RandomRemote()if err != nil {r.Fatalf("Failed to open remote %q: %v", *RemoteName, err)}diff --git a/fstest/test_all/config.go b/fstest/test_all/config.goindex 9a8d3718c..8f15a9b58 100644--- a/fstest/test_all/config.go+++ b/fstest/test_all/config.go@@ -17,7 +17,6 @@ import (// Test describes an integration test to run with `go test`type Test struct {Path string // path to the source directory- SubDir bool // if it is possible to add -sub-dir to testsFastList bool // if it is possible to add -fast-list to testsAddBackend bool // set if Path needs the current backend appendingNoRetries bool // set if no retries should be performed@@ -31,7 +30,6 @@ type Test struct {type Backend struct {Backend string // name of the backend directoryRemote string // name of the test remote- SubDir bool // set to test with -sub-dirFastList bool // set to test with -fast-listOneOnly bool // set to run only one backend test at onceIgnore []string // test names to ignore the failure of@@ -54,16 +52,12 @@ func (b *Backend) includeTest(t *Test) bool {// MakeRuns creates Run objects the Backend and Test//-// There can be several created, one for each combination of SubDir-// and FastList+// There can be several created, one for each combination of optionl+// flags (eg FastList)func (b *Backend) MakeRuns(t *Test) (runs []*Run) {if !b.includeTest(t) {return runs}- subdirs := []bool{false}- if b.SubDir && t.SubDir {- subdirs = append(subdirs, true)- }fastlists := []bool{false}if b.FastList && t.FastList {fastlists = append(fastlists, true)@@ -72,27 +66,24 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) {for _, item := range b.Ignore {ignore[item] = struct{}{}}- for _, subdir := range subdirs {- for _, fastlist := range fastlists {- if t.LocalOnly && b.Backend != "local" {- continue- }- run := &Run{- Remote: b.Remote,- Backend: b.Backend,- Path: t.Path,- SubDir: subdir,- FastList: fastlist,- NoRetries: t.NoRetries,- OneOnly: b.OneOnly,- NoBinary: t.NoBinary,- Ignore: ignore,- }- if t.AddBackend {- run.Path = path.Join(run.Path, b.Backend)- }- runs = append(runs, run)+ for _, fastlist := range fastlists {+ if t.LocalOnly && b.Backend != "local" {+ continue+ }+ run := &Run{+ Remote: b.Remote,+ Backend: b.Backend,+ Path: t.Path,+ FastList: fastlist,+ NoRetries: t.NoRetries,+ OneOnly: b.OneOnly,+ NoBinary: t.NoBinary,+ Ignore: ignore,+ }+ if t.AddBackend {+ run.Path = path.Join(run.Path, b.Backend)}+ runs = append(runs, run)}return runs}diff --git a/fstest/test_all/config.yaml b/fstest/test_all/config.yamlindex 908697ebf..890a776c5 100644--- a/fstest/test_all/config.yaml+++ b/fstest/test_all/config.yaml@@ -3,10 +3,8 @@ tests:addbackend: truenobinary: true- path: fs/operations- subdir: truefastlist: true- path: fs/sync- subdir: truefastlist: true- path: vfs- path: cmd/serve/restic@@ -14,35 +12,27 @@ tests:backends:# - backend: "amazonclouddrive"# remote: "TestAmazonCloudDrive:"- # subdir: false# fastlist: false- backend: "local"remote: ""- subdir: falsefastlist: false- backend: "b2"remote: "TestB2:"- subdir: truefastlist: true- backend: "crypt"remote: "TestCryptDrive:"- subdir: falsefastlist: true- backend: "crypt"remote: "TestCryptSwift:"- subdir: falsefastlist: false- backend: "drive"remote: "TestDrive:"- subdir: falsefastlist: true- backend: "dropbox"remote: "TestDropbox:"- subdir: falsefastlist: false- backend: "googlecloudstorage"remote: "TestGoogleCloudStorage:"- subdir: truefastlist: true- backend: "googlephotos"remote: "TestGooglePhotos:"@@ -50,114 +40,88 @@ backends:- backend- backend: "hubic"remote: "TestHubic:"- subdir: falsefastlist: false- backend: "jottacloud"remote: "TestJottacloud:"- subdir: falsefastlist: true- backend: "onedrive"remote: "TestOneDrive:"- subdir: falsefastlist: false- backend: "s3"remote: "TestS3:"- subdir: truefastlist: true- backend: "s3"remote: "TestS3Minio:"- subdir: truefastlist: true- backend: "s3"remote: "TestS3Wasabi:"- subdir: truefastlist: true- backend: "s3"remote: "TestS3DigitalOcean:"- subdir: truefastlist: trueignore:- TestIntegration/FsMkdir/FsPutFiles/FsCopy- backend: "s3"remote: "TestS3Ceph:"- subdir: truefastlist: trueignore:- TestIntegration/FsMkdir/FsPutFiles/FsCopy- backend: "s3"remote: "TestS3Alibaba:"- subdir: truefastlist: true- backend: "sftp"remote: "TestSftp:"- subdir: falsefastlist: false- backend: "swift"remote: "TestSwift:"- subdir: truefastlist: true- backend: "swift"remote: "TestSwiftCeph:"- subdir: truefastlist: trueignore:- TestIntegration/FsMkdir/FsPutFiles/FsCopy- backend: "yandex"remote: "TestYandex:"- subdir: falsefastlist: false- backend: "ftp"remote: "TestFTP:"- subdir: falsefastlist: false- backend: "box"remote: "TestBox:"- subdir: falsefastlist: false- backend: "fichier"remote: "TestFichier:"- subdir: falsefastlist: false- backend: "qingstor"remote: "TestQingStor:"- subdir: falsefastlist: falseoneonly: true- backend: "azureblob"remote: "TestAzureBlob:"- subdir: truefastlist: true- backend: "pcloud"remote: "TestPcloud:"- subdir: falsefastlist: false- backend: "webdav"remote: "TestWebdav:"- subdir: falsefastlist: false- backend: "cache"remote: "TestCache:"- subdir: falsefastlist: false- backend: "mega"remote: "TestMega:"- subdir: falsefastlist: falseignore:- TestIntegration/FsMkdir/FsPutFiles/PublicLink- backend: "opendrive"remote: "TestOpenDrive:"- subdir: falsefastlist: false- backend: "union"remote: "TestUnion:"- subdir: falsefastlist: false- backend: "koofr"remote: "TestKoofr:"- subdir: falsefastlist: false- backend: "premiumizeme"remote: "TestPremiumizeMe:"- subdir: falsefastlist: falsediff --git a/fstest/test_all/report.go b/fstest/test_all/report.goindex 44e2a7eae..3de70e900 100644--- a/fstest/test_all/report.go+++ b/fstest/test_all/report.go@@ -208,7 +208,6 @@ a:focus {<th>Backend</th><th>Remote</th><th>Test</th>-<th>SubDir</th><th>FastList</th><th>Failed</th><th>Logs</th>@@ -220,7 +219,6 @@ a:focus {<td>{{ if ne $prevBackend .Backend }}{{ .Backend }}{{ end }}{{ $prevBackend = .Backend }}</td><td>{{ if ne $prevRemote .Remote }}{{ .Remote }}{{ end }}{{ $prevRemote = .Remote }}</td><td>{{ .Path }}</td>-<td><span class="{{ .SubDir }}">{{ .SubDir }}</span></td><td><span class="{{ .FastList }}">{{ .FastList }}</span></td><td>{{ .FailedTests }}</td><td>{{ range $i, $v := .Logs }}<a href="{{ $v }}">#{{ $i }}</a> {{ end }}</td>diff --git a/fstest/test_all/run.go b/fstest/test_all/run.goindex 6dd314c45..141d7e135 100644--- a/fstest/test_all/run.go+++ b/fstest/test_all/run.go@@ -38,7 +38,6 @@ type Run struct {Remote string // name of the test remoteBackend string // name of the backendPath string // path to the source directory- SubDir bool // add -sub-dir to testsFastList bool // add -fast-list to testsNoRetries bool // don't retry if setOneOnly bool // only run test for this backend at once@@ -80,11 +79,6 @@ func (rs Runs) Less(i, j int) bool {} else if a.Path > b.Path {return false}- if !a.SubDir && b.SubDir {- return true- } else if a.SubDir && !b.SubDir {- return false- }if !a.FastList && b.FastList {return true} else if a.FastList && !b.FastList {@@ -311,9 +305,6 @@ func (r *Run) Name() string {strings.Replace(r.Path, "/", ".", -1),r.Remote,}- if r.SubDir {- ns = append(ns, "subdir")- }if r.FastList {ns = append(ns, "fastlist")}@@ -341,9 +332,6 @@ func (r *Run) Init() {if *runOnly != "" {r.cmdLine = append(r.cmdLine, prefix+"run", *runOnly)}- if r.SubDir {- r.cmdLine = append(r.cmdLine, "-subdir")- }if r.FastList {r.cmdLine = append(r.cmdLine, "-fast-list")}