"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
Prefix all test remotes with `rclone-test-` and make names more pronouncable
Nick Craig-Wood109d4ee49054
diff --git a/fs/test_all.go b/fs/test_all.goindex 73bbd9339..3faf86d39 100644--- a/fs/test_all.go+++ b/fs/test_all.go@@ -10,13 +10,13 @@ import ("log""os""os/exec"- "regexp""runtime""strings""time""github.com/ncw/rclone/fs"_ "github.com/ncw/rclone/fs/all" // import all fs+ "github.com/ncw/rclone/fstest")var (@@ -83,13 +83,6 @@ func (t *test) trial() {}}-var (- // matchTestRemote matches the remote names used for testing- matchTestRemote = regexp.MustCompile(`^[abcdefghijklmnopqrstuvwxyz0123456789]{32}$`)- // findInteriorDigits makes sure there are digits inside the string- findInteriorDigits = regexp.MustCompile(`[a-z][0-9]+[a-z]`)-)-// cleanFs runs a single clean fs for left over directoriesfunc (t *test) cleanFs() error {f, err := fs.NewFs(t.remote)@@ -97,8 +90,7 @@ func (t *test) cleanFs() error {return err}for dir := range f.ListDir() {- insideDigits := len(findInteriorDigits.FindAllString(dir.Name, -1))- if matchTestRemote.MatchString(dir.Name) && insideDigits >= 2 {+ if fstest.MatchTestRemote.MatchString(dir.Name) {log.Printf("Purging %s%s", t.remote, dir.Name)dir, err := fs.NewFs(t.remote + dir.Name)if err != nil {diff --git a/fstest/fstest.go b/fstest/fstest.goindex bbb9a6cea..cd3c3f383 100644--- a/fstest/fstest.go+++ b/fstest/fstest.go@@ -11,6 +11,7 @@ import ("math/rand""os""path/filepath"+ "regexp""strings""testing""time"@@ -18,6 +19,11 @@ import ("github.com/ncw/rclone/fs")+var (+ // MatchTestRemote matches the remote names used for testing+ MatchTestRemote = regexp.MustCompile(`^rclone-test-[abcdefghijklmnopqrstuvwxyz0123456789]{24}$`)+)+// Seed the random number generatorfunc init() {rand.Seed(time.Now().UnixNano())@@ -206,9 +212,17 @@ func Time(timeString string) time.Time {// RandomString create a random string for test purposesfunc RandomString(n int) string {- source := "abcdefghijklmnopqrstuvwxyz0123456789"+ const (+ vowel = "aeiou"+ consonant = "bcdfghjklmnpqrstvwxyz"+ digit = "0123456789"+ )+ pattern := []string{consonant, vowel, consonant, vowel, consonant, vowel, consonant, digit}out := make([]byte, n)+ p := 0for i := range out {+ source := pattern[p]+ p = (p + 1) % len(pattern)out[i] = source[rand.Intn(len(source))]}return string(out)@@ -242,7 +256,10 @@ func RandomRemoteName(remoteName string) (string, string, error) {if !strings.HasSuffix(remoteName, ":") {remoteName += "/"}- leafName = RandomString(32)+ leafName = "rclone-test-" + RandomString(24)+ if !MatchTestRemote.MatchString(leafName) {+ log.Fatalf("%q didn't match the test remote name regexp", leafName)+ }remoteName += leafName}return remoteName, leafName, nil@@ -266,7 +283,7 @@ func RandomRemote(remoteName string, subdir bool) (fs.Fs, func(), error) {if err != nil {return nil, nil, err}- remoteName += "/" + RandomString(8)+ remoteName += "/rclone-test-subdir-" + RandomString(8)}remote, err := fs.NewFs(remoteName)