bisync: delete flushCache() function from tests

The flushCache() function has a bug that causes it to never actually
flush the cache. Specifically, it checks whether DirCacheFlush is nil,
but never calls it.

The tests are already passing without flushing the dir cache, so this
commit just deletes flushCache() and its call sites.

Fixes rclone/rclone#7623
This commit is contained in:
Dan McArdle 2024-02-10 12:44:17 -05:00 committed by nielash
parent 11c6489fd1
commit 6986a43b68

View File

@ -532,7 +532,6 @@ func (b *bisyncTest) runTestStep(ctx context.Context, line string) (err error) {
if err != nil { if err != nil {
return err return err
} }
flushCache(fsrc)
return return
case "delete-file": case "delete-file":
b.checkArgs(args, 1, 1) b.checkArgs(args, 1, 1)
@ -769,13 +768,6 @@ func (b *bisyncTest) checkArgs(args []string, min, max int) {
} }
} }
func flushCache(f fs.Fs) {
dirCacheFlush := f.Features().DirCacheFlush
if dirCacheFlush == nil {
fs.Errorf(nil, "%v: can't flush dir cache", f)
}
}
func (b *bisyncTest) runBisync(ctx context.Context, args []string) (err error) { func (b *bisyncTest) runBisync(ctx context.Context, args []string) (err error) {
opt := &bisync.Options{ opt := &bisync.Options{
Workdir: b.workDir, Workdir: b.workDir,
@ -789,10 +781,6 @@ func (b *bisyncTest) runBisync(ctx context.Context, args []string) (err error) {
octx, ci := fs.AddConfig(ctx) octx, ci := fs.AddConfig(ctx)
fs1, fs2 := b.fs1, b.fs2 fs1, fs2 := b.fs1, b.fs2
// flush cache
flushCache(fs1)
flushCache(fs2)
addSubdir := func(path, subdir string) fs.Fs { addSubdir := func(path, subdir string) fs.Fs {
remote := path + subdir remote := path + subdir
f, err := fs.NewFs(ctx, remote) f, err := fs.NewFs(ctx, remote)
@ -968,9 +956,6 @@ func (b *bisyncTest) listSubdirs(ctx context.Context, remote string, DirsOnly bo
return err return err
} }
// flush cache
flushCache(f)
opt := operations.ListJSONOpt{ opt := operations.ListJSONOpt{
NoModTime: true, NoModTime: true,
NoMimeType: true, NoMimeType: true,