"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 WinPath from fstest.Item
Fabian Möller97a218903c29
diff --git a/fs/operations/operations_test.go b/fs/operations/operations_test.goindex e7382c808..b0112683f 100644--- a/fs/operations/operations_test.go+++ b/fs/operations/operations_test.go@@ -1323,7 +1323,6 @@ func TestDirMove(t *testing.T) {for i := range files {files[i].Path = strings.Replace(files[i].Path, "A1/", "A2/", -1)- files[i].WinPath = ""}fstest.CheckListingWithPrecision(@@ -1353,7 +1352,6 @@ func TestDirMove(t *testing.T) {for i := range files {files[i].Path = strings.Replace(files[i].Path, "A2/", "A3/", -1)- files[i].WinPath = ""}fstest.CheckListingWithPrecision(diff --git a/fstest/fstest.go b/fstest/fstest.goindex 509d034bb..3e2fa38fa 100644--- a/fstest/fstest.go+++ b/fstest/fstest.go@@ -88,7 +88,6 @@ type Item struct {Hashes map[hash.Type]stringModTime time.TimeSize int64- WinPath string}// NewItem creates an item from a string content@@ -181,7 +180,6 @@ func NewItems(items []Item) *Items {// Fill up byNamefor i := range items {is.byName[Normalize(items[i].Path)] = &items[i]- is.byNameAlt[Normalize(items[i].WinPath)] = &items[i]}return is}@@ -196,7 +194,6 @@ func (is *Items) Find(t *testing.T, obj fs.Object, precision time.Duration) {}if i != nil {delete(is.byName, i.Path)- delete(is.byName, i.WinPath)i.Check(t, obj, precision)}}@@ -214,21 +211,14 @@ func (is *Items) Done(t *testing.T) {// makeListingFromItems returns a string representation of the items//// it returns two possible strings, one normal and one for windows-func makeListingFromItems(items []Item) (string, string) {- nameLengths1 := make([]string, len(items))- nameLengths2 := make([]string, len(items))+func makeListingFromItems(items []Item) string {+ nameLengths := make([]string, len(items))for i, item := range items {- remote1 := Normalize(item.Path)- remote2 := remote1- if item.WinPath != "" {- remote2 = item.WinPath- }- nameLengths1[i] = fmt.Sprintf("%s (%d)", remote1, item.Size)- nameLengths2[i] = fmt.Sprintf("%s (%d)", remote2, item.Size)+ remote := Normalize(item.Path)+ nameLengths[i] = fmt.Sprintf("%s (%d)", remote, item.Size)}- sort.Strings(nameLengths1)- sort.Strings(nameLengths2)- return strings.Join(nameLengths1, ", "), strings.Join(nameLengths2, ", ")+ sort.Strings(nameLengths)+ return strings.Join(nameLengths, ", ")}// makeListingFromObjects returns a string representation of the objects@@ -285,7 +275,7 @@ func CheckListingWithRoot(t *testing.T, f fs.Fs, dir string, items []Item, expecvar err errorvar retries = *ListRetriessleep := time.Second / 2- wantListing1, wantListing2 := makeListingFromItems(items)+ wantListing := makeListingFromItems(items)gotListing := "<unset>"listingOK := falsefor i := 1; i <= retries; i++ {@@ -295,7 +285,7 @@ func CheckListingWithRoot(t *testing.T, f fs.Fs, dir string, items []Item, expec}gotListing = makeListingFromObjects(objs)- listingOK = wantListing1 == gotListing || wantListing2 == gotListing+ listingOK = wantListing == gotListingif listingOK && (expectedDirs == nil || len(dirs) == len(expectedDirs)) {// Put an extra sleep in if we did any retries just to make sure it really// is consistent (here is looking at you Amazon Drive!)@@ -314,7 +304,7 @@ func CheckListingWithRoot(t *testing.T, f fs.Fs, dir string, items []Item, expecdoDirCacheFlush()}}- assert.True(t, listingOK, fmt.Sprintf("listing wrong, want\n %s or\n %s got\n %s", wantListing1, wantListing2, gotListing))+ assert.True(t, listingOK, fmt.Sprintf("listing wrong, want\n %s got\n %s", wantListing, gotListing))for _, obj := range objs {require.NotNil(t, obj)is.Find(t, obj, precision)@@ -368,7 +358,7 @@ func CompareItems(t *testing.T, entries fs.DirEntries, items []Item, expectedDiris := NewItems(items)var objs []fs.Objectvar dirs []fs.Directory- wantListing1, wantListing2 := makeListingFromItems(items)+ wantListing := makeListingFromItems(items)for _, entry := range entries {switch x := entry.(type) {case fs.Directory:@@ -382,8 +372,8 @@ func CompareItems(t *testing.T, entries fs.DirEntries, items []Item, expectedDir}gotListing := makeListingFromObjects(objs)- listingOK := wantListing1 == gotListing || wantListing2 == gotListing- assert.True(t, listingOK, fmt.Sprintf("%s not equal, want\n %s or\n %s got\n %s", what, wantListing1, wantListing2, gotListing))+ listingOK := wantListing == gotListing+ assert.True(t, listingOK, fmt.Sprintf("%s not equal, want\n %s got\n %s", what, wantListing, gotListing))for _, obj := range objs {require.NotNil(t, obj)is.Find(t, obj, precision)diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.goindex 310b31a91..c9a2fd0d9 100644--- a/fstest/fstests/fstests.go+++ b/fstest/fstests/fstests.go@@ -292,7 +292,6 @@ func Run(t *testing.T, opt *Opt) {file2 = fstest.Item{ModTime: fstest.Time("2001-02-03T04:05:10.123123123Z"),Path: `hello? sausage/êé/Hello, 世界/ " ' @ < > & ? + ≠/z.txt`,- WinPath: `hello_ sausage/êé/Hello, 世界/ _ ' @ _ _ & _ + ≠/z.txt`,}isLocalRemote boolpurged bool // whether the dir has been purged or not@@ -832,10 +831,6 @@ func Run(t *testing.T, opt *Opt) {dir, _ := path.Split(fileName)dir = dir[:len(dir)-1]objs, dirs, err = walk.GetAll(context.Background(), remote, dir, true, -1)- if err != fs.ErrorDirNotFound {- break- }- fileName = file2.WinPath}require.NoError(t, err)require.Len(t, objs, 1)@@ -951,7 +946,6 @@ func Run(t *testing.T, opt *Opt) {// check happy path, i.e. no naming conflicts when rename and move are two// separate operationsfile2Move.Path = "other.txt"- file2Move.WinPath = ""src := findObject(t, remote, file2.Path)dst, err := doMove(context.Background(), src, file2Move.Path)if err == fs.ErrorCantMove {@@ -1036,7 +1030,6 @@ func Run(t *testing.T, opt *Opt) {file1Copy.Path = path.Join(newName, file1.Path)file2Copy := file2file2Copy.Path = path.Join(newName, file2.Path)- file2Copy.WinPath = path.Join(newName, file2.WinPath)fstest.CheckListingWithPrecision(t, newRemote, []fstest.Item{file2Copy, file1Copy}, []string{"new_name","new_name/sub_new_name",@@ -1261,7 +1254,6 @@ func Run(t *testing.T, opt *Opt) {remoteName := subRemoteName + "/" + file2.Pathfile2Copy := file2file2Copy.Path = "z.txt"- file2Copy.WinPath = ""fileRemote, err := fs.NewFs(remoteName)require.NotNil(t, fileRemote)assert.Equal(t, fs.ErrorIsFile, err)@@ -1304,7 +1296,6 @@ func Run(t *testing.T, opt *Opt) {file1Root.Path = path.Join(configLeaf, file1Root.Path)file2Root := file2file2Root.Path = path.Join(configLeaf, file2Root.Path)- file2Root.WinPath = path.Join(configLeaf, file2Root.WinPath)var dirs []stringdir := file2.Pathfor {