From d2ad293fae4051c729dcaf3c5ee8cb798700d06d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 19 Aug 2020 16:58:10 +0100 Subject: [PATCH] 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. --- bin/test-repeat-vfs.sh | 4 ---- vfs/file_test.go | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/test-repeat-vfs.sh b/bin/test-repeat-vfs.sh index 396b232c8..c0eee3795 100755 --- a/bin/test-repeat-vfs.sh +++ b/bin/test-repeat-vfs.sh @@ -16,10 +16,6 @@ vfs/vfscache/downloaders cmd/cmount " -testdirs=" -cmd/cmount -" - for testdir in ${testdirs}; do echo "Testing ${testdir}" cd ${base}/${testdir} diff --git a/vfs/file_test.go b/vfs/file_test.go index 59e30a778..0df50bfbd 100644 --- a/vfs/file_test.go +++ b/vfs/file_test.go @@ -265,9 +265,12 @@ func testFileRename(t *testing.T, mode vfscommon.CacheMode, inCache bool, forceC require.NoError(t, err) require.Equal(t, 14, n) + require.NoError(t, file.SetModTime(item.ModTime)) + err = fd.Close() require.NoError(t, err) } + vfs.WaitForWriters(waitForWritersDelay) // check file in cache if inCache {