"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
Test Listing the Root of each Fs
Nick Craig-Woodd3c16608e417
diff --git a/drive/drive_test.go b/drive/drive_test.goindex a9fda817a..77e45c6c8 100644--- a/drive/drive_test.go+++ b/drive/drive_test.go@@ -30,6 +30,7 @@ func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }+func TestFsListRoot(t *testing.T) { fstests.TestFsListRoot(t) }func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }func TestFsNewFsObject(t *testing.T) { fstests.TestFsNewFsObject(t) }func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }diff --git a/dropbox/dropbox_test.go b/dropbox/dropbox_test.goindex 16d2cf000..1bd5367d2 100644--- a/dropbox/dropbox_test.go+++ b/dropbox/dropbox_test.go@@ -30,6 +30,7 @@ func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }+func TestFsListRoot(t *testing.T) { fstests.TestFsListRoot(t) }func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }func TestFsNewFsObject(t *testing.T) { fstests.TestFsNewFsObject(t) }func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex e58409ad6..330fdabf3 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -7,7 +7,6 @@ import ("bytes""crypto/md5""encoding/hex"- "fmt""io""log""os"@@ -183,7 +182,6 @@ func TestFsListDirRoot(t *testing.T) {}found := falsefor obj := range rootRemote.ListDir() {- fmt.Printf("obj = %q\n", obj.Name)if obj.Name == subRemoteLeaf {found = true}@@ -193,6 +191,44 @@ func TestFsListDirRoot(t *testing.T) {}}+func TestFsListRoot(t *testing.T) {+ skipIfNotOk(t)+ rootRemote, err := fs.NewFs(RemoteName)+ if err != nil {+ t.Fatal("Failed to make remote %q: %v", RemoteName, err)+ }+ // Should either find file1 and file2 or nothing+ found1 := false+ file1 := subRemoteLeaf + "/" + file1.Path+ found2 := false+ file2 := subRemoteLeaf + "/" + file2.Path+ count := 0+ errors := fs.Stats.GetErrors()+ for obj := range rootRemote.List() {+ count+++ if obj.Remote() == file1 {+ found1 = true+ }+ if obj.Remote() == file2 {+ found2 = true+ }+ }+ errors -= fs.Stats.GetErrors()+ if count == 0 {+ if errors == 0 {+ t.Error("Expecting error if count==0")+ }+ return+ }+ if found1 && found2 {+ if errors != 0 {+ t.Error("Not expecting error if found")+ }+ return+ }+ t.Errorf("Didn't find %q (%v) and %q (%v) or no files (count %d)", file1, found1, file2, found2, count)+}+func TestFsListFile1(t *testing.T) {skipIfNotOk(t)fstest.CheckListing(remote, []fstest.Item{file1, file2})diff --git a/googlecloudstorage/googlecloudstorage_test.go b/googlecloudstorage/googlecloudstorage_test.goindex 135e379e9..75f4683ca 100644--- a/googlecloudstorage/googlecloudstorage_test.go+++ b/googlecloudstorage/googlecloudstorage_test.go@@ -30,6 +30,7 @@ func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }+func TestFsListRoot(t *testing.T) { fstests.TestFsListRoot(t) }func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }func TestFsNewFsObject(t *testing.T) { fstests.TestFsNewFsObject(t) }func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }diff --git a/local/local_test.go b/local/local_test.goindex 3abe16ff9..2cfe03594 100644--- a/local/local_test.go+++ b/local/local_test.go@@ -30,6 +30,7 @@ func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }+func TestFsListRoot(t *testing.T) { fstests.TestFsListRoot(t) }func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }func TestFsNewFsObject(t *testing.T) { fstests.TestFsNewFsObject(t) }func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }diff --git a/notes.txt b/notes.txtindex 7d8bf1524..ba3b8b66f 100644--- a/notes.txt+++ b/notes.txt@@ -2,11 +2,11 @@ Change lsd command so it doesn't show -1* Make sure all Fses show -1 for objects Zero for dates etc* Make test?-Make a subdir test on an existing file (file2 say) (List and ListDir)-Put the TestRemote names into the Fs descriptionMake rclonetest use the TestRemote name automaticallyPut rclonetest back into rclone as tests+ * defaults to using local remote+ * but could pass another in with a flagRun errcheck and go vet in the make file.. Also race detector?diff --git a/s3/s3_test.go b/s3/s3_test.goindex a5196f17f..7ba3f97e1 100644--- a/s3/s3_test.go+++ b/s3/s3_test.go@@ -30,6 +30,7 @@ func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }+func TestFsListRoot(t *testing.T) { fstests.TestFsListRoot(t) }func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }func TestFsNewFsObject(t *testing.T) { fstests.TestFsNewFsObject(t) }func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }diff --git a/swift/swift_test.go b/swift/swift_test.goindex 43057282d..f227f67fb 100644--- a/swift/swift_test.go+++ b/swift/swift_test.go@@ -30,6 +30,7 @@ func TestFsPutFile1(t *testing.T) { fstests.TestFsPutFile1(t) }func TestFsPutFile2(t *testing.T) { fstests.TestFsPutFile2(t) }func TestFsListDirFile2(t *testing.T) { fstests.TestFsListDirFile2(t) }func TestFsListDirRoot(t *testing.T) { fstests.TestFsListDirRoot(t) }+func TestFsListRoot(t *testing.T) { fstests.TestFsListRoot(t) }func TestFsListFile1(t *testing.T) { fstests.TestFsListFile1(t) }func TestFsNewFsObject(t *testing.T) { fstests.TestFsNewFsObject(t) }func TestFsListFile1and2(t *testing.T) { fstests.TestFsListFile1and2(t) }