mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 15:38:57 +01:00
fstest: Fix CheckWithDuplicates after code reshuffle to not use operations
This commit is contained in:
parent
fa500e6d21
commit
d016438243
@ -27,6 +27,7 @@ package fstest
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -40,6 +41,7 @@ import (
|
|||||||
"github.com/ncw/rclone/fs/fserrors"
|
"github.com/ncw/rclone/fs/fserrors"
|
||||||
"github.com/ncw/rclone/fs/object"
|
"github.com/ncw/rclone/fs/object"
|
||||||
"github.com/ncw/rclone/fs/walk"
|
"github.com/ncw/rclone/fs/walk"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -267,15 +269,27 @@ func (r *Run) WriteBoth(remote, content string, modTime time.Time) Item {
|
|||||||
|
|
||||||
// CheckWithDuplicates does a test but allows duplicates
|
// CheckWithDuplicates does a test but allows duplicates
|
||||||
func (r *Run) CheckWithDuplicates(t *testing.T, items ...Item) {
|
func (r *Run) CheckWithDuplicates(t *testing.T, items ...Item) {
|
||||||
panic("FIXME")
|
var want, got []string
|
||||||
// objects, size, err := operations.Count(r.Fremote)
|
|
||||||
// require.NoError(t, err)
|
// construct a []string of desired items
|
||||||
// assert.Equal(t, int64(len(items)), objects)
|
for _, item := range items {
|
||||||
// wantSize := int64(0)
|
want = append(want, fmt.Sprintf("%q %d", item.Path, item.Size))
|
||||||
// for _, item := range items {
|
}
|
||||||
// wantSize += item.Size
|
sort.Strings(want)
|
||||||
// }
|
|
||||||
// assert.Equal(t, wantSize, size)
|
// do the listing
|
||||||
|
objs, _, err := walk.GetAll(r.Fremote, "", true, -1)
|
||||||
|
if err != nil && err != fs.ErrorDirNotFound {
|
||||||
|
t.Fatalf("Error listing: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// construct a []string of actual items
|
||||||
|
for _, o := range objs {
|
||||||
|
got = append(got, fmt.Sprintf("%q %d", o.Remote(), o.Size()))
|
||||||
|
}
|
||||||
|
sort.Strings(got)
|
||||||
|
|
||||||
|
assert.Equal(t, want, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean the temporary directory
|
// Clean the temporary directory
|
||||||
|
Loading…
Reference in New Issue
Block a user