vfs: fix rename tests by waiting for writes to complete

Before this change the background writing of the file was racing with
the test of the object on the remote.

This meant that the tests passed locally but failed on a lot of the
remotes.
This commit is contained in:
Nick Craig-Wood 2020-08-19 16:58:10 +01:00
parent 6082096f7e
commit d2ad293fae
2 changed files with 3 additions and 4 deletions

View File

@ -16,10 +16,6 @@ vfs/vfscache/downloaders
cmd/cmount cmd/cmount
" "
testdirs="
cmd/cmount
"
for testdir in ${testdirs}; do for testdir in ${testdirs}; do
echo "Testing ${testdir}" echo "Testing ${testdir}"
cd ${base}/${testdir} cd ${base}/${testdir}

View File

@ -265,9 +265,12 @@ func testFileRename(t *testing.T, mode vfscommon.CacheMode, inCache bool, forceC
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, 14, n) require.Equal(t, 14, n)
require.NoError(t, file.SetModTime(item.ModTime))
err = fd.Close() err = fd.Close()
require.NoError(t, err) require.NoError(t, err)
} }
vfs.WaitForWriters(waitForWritersDelay)
// check file in cache // check file in cache
if inCache { if inCache {