mirror of
https://github.com/rclone/rclone.git
synced 2024-11-07 17:14:44 +01:00
mounttest: wait for Release after every Read to stop using in use files under Windows
This commit is contained in:
parent
8e2213fbbd
commit
af50f31f7d
@ -1,7 +1,6 @@
|
||||
package mounttest
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@ -78,17 +77,16 @@ func TestDirRenameFile(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
run.checkDir(t, "dir/|file2 6")
|
||||
|
||||
data, err := ioutil.ReadFile(run.path("file2"))
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "potato", string(data))
|
||||
data := run.readFile(t, "file2")
|
||||
assert.Equal(t, "potato", data)
|
||||
|
||||
err = os.Rename(run.path("file2"), run.path("dir/file3"))
|
||||
require.NoError(t, err)
|
||||
run.checkDir(t, "dir/|dir/file3 6")
|
||||
|
||||
data, err = ioutil.ReadFile(run.path("dir/file3"))
|
||||
data = run.readFile(t, "dir/file3")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "potato", string(data))
|
||||
assert.Equal(t, "potato", data)
|
||||
|
||||
run.rm(t, "dir/file3")
|
||||
run.rmdir(t, "dir")
|
||||
|
@ -325,6 +325,7 @@ func (r *Run) readFile(t *testing.T, filepath string) string {
|
||||
filepath = r.path(filepath)
|
||||
result, err := ioutil.ReadFile(filepath)
|
||||
require.NoError(t, err)
|
||||
time.Sleep(100 * time.Millisecond) // FIXME wait for Release
|
||||
return string(result)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user