forked from TrueCloudLab/rclone
fstest: add precision to CompareItems so it works on non-local remotes
This commit is contained in:
parent
9f549f848d
commit
743dabf159
2 changed files with 10 additions and 8 deletions
|
@ -207,9 +207,10 @@ func TestMarch(t *testing.T) {
|
||||||
err := mt.currentError()
|
err := mt.currentError()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, "srcOnly")
|
precision := fs.GetModifyWindow(r.Fremote, r.Flocal)
|
||||||
fstest.CompareItems(t, mt.dstOnly, dstOnly, test.dirDstOnly, "dstOnly")
|
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, precision, "srcOnly")
|
||||||
fstest.CompareItems(t, mt.match, match, test.dirMatch, "match")
|
fstest.CompareItems(t, mt.dstOnly, dstOnly, test.dirDstOnly, precision, "dstOnly")
|
||||||
|
fstest.CompareItems(t, mt.match, match, test.dirMatch, precision, "match")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,8 +274,9 @@ func TestMarchNoTraverse(t *testing.T) {
|
||||||
err := mt.currentError()
|
err := mt.currentError()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, "srcOnly")
|
precision := fs.GetModifyWindow(r.Fremote, r.Flocal)
|
||||||
fstest.CompareItems(t, mt.match, match, test.dirMatch, "match")
|
fstest.CompareItems(t, mt.srcOnly, srcOnly, test.dirSrcOnly, precision, "srcOnly")
|
||||||
|
fstest.CompareItems(t, mt.match, match, test.dirMatch, precision, "match")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,10 +348,10 @@ func CheckItems(t *testing.T, f fs.Fs, items ...Item) {
|
||||||
CheckListingWithPrecision(t, f, items, nil, fs.GetModifyWindow(f))
|
CheckListingWithPrecision(t, f, items, nil, fs.GetModifyWindow(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
// CompareItems compares a set of DirEntries to a slice of items and a lit of dirs
|
// CompareItems compares a set of DirEntries to a slice of items and a list of dirs
|
||||||
func CompareItems(t *testing.T, entries fs.DirEntries, items []Item, expectedDirs []string, what string) {
|
// The modtimes are compared with the precision supplied
|
||||||
|
func CompareItems(t *testing.T, entries fs.DirEntries, items []Item, expectedDirs []string, precision time.Duration, what string) {
|
||||||
is := NewItems(items)
|
is := NewItems(items)
|
||||||
precision, _ := time.ParseDuration("1s")
|
|
||||||
var objs []fs.Object
|
var objs []fs.Object
|
||||||
var dirs []fs.Directory
|
var dirs []fs.Directory
|
||||||
wantListing1, wantListing2 := makeListingFromItems(items)
|
wantListing1, wantListing2 := makeListingFromItems(items)
|
||||||
|
|
Loading…
Add table
Reference in a new issue