mirror of
https://github.com/rclone/rclone.git
synced 2025-08-17 17:11:37 +02:00
fstests: add tests for operations from the root of the Fs #3421
This commit is contained in:
@@ -263,13 +263,15 @@ func filterEmptyDirs(t *testing.T, items []Item, expectedDirs []string) (newExpe
|
||||
return newExpectedDirs
|
||||
}
|
||||
|
||||
// CheckListingWithPrecision checks the fs to see if it has the
|
||||
// CheckListingWithRoot checks the fs to see if it has the
|
||||
// expected contents with the given precision.
|
||||
//
|
||||
// If expectedDirs is non nil then we check those too. Note that no
|
||||
// directories returned is also OK as some remotes don't return
|
||||
// directories.
|
||||
func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, expectedDirs []string, precision time.Duration) {
|
||||
//
|
||||
// dir is the directory used for the listing.
|
||||
func CheckListingWithRoot(t *testing.T, f fs.Fs, dir string, items []Item, expectedDirs []string, precision time.Duration) {
|
||||
if expectedDirs != nil && !f.Features().CanHaveEmptyDirectories {
|
||||
expectedDirs = filterEmptyDirs(t, items, expectedDirs)
|
||||
}
|
||||
@@ -285,7 +287,7 @@ func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, expectedDirs
|
||||
gotListing := "<unset>"
|
||||
listingOK := false
|
||||
for i := 1; i <= retries; i++ {
|
||||
objs, dirs, err = walk.GetAll(ctx, f, "", true, -1)
|
||||
objs, dirs, err = walk.GetAll(ctx, f, dir, true, -1)
|
||||
if err != nil && err != fs.ErrorDirNotFound {
|
||||
t.Fatalf("Error listing: %v", err)
|
||||
}
|
||||
@@ -336,6 +338,16 @@ func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, expectedDirs
|
||||
}
|
||||
}
|
||||
|
||||
// CheckListingWithPrecision checks the fs to see if it has the
|
||||
// expected contents with the given precision.
|
||||
//
|
||||
// If expectedDirs is non nil then we check those too. Note that no
|
||||
// directories returned is also OK as some remotes don't return
|
||||
// directories.
|
||||
func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, expectedDirs []string, precision time.Duration) {
|
||||
CheckListingWithRoot(t, f, "", items, expectedDirs, precision)
|
||||
}
|
||||
|
||||
// CheckListing checks the fs to see if it has the expected contents
|
||||
func CheckListing(t *testing.T, f fs.Fs, items []Item) {
|
||||
precision := f.Precision()
|
||||
|
Reference in New Issue
Block a user