mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 15:38:57 +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
|
package mounttest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -78,17 +77,16 @@ func TestDirRenameFile(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
run.checkDir(t, "dir/|file2 6")
|
run.checkDir(t, "dir/|file2 6")
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(run.path("file2"))
|
data := run.readFile(t, "file2")
|
||||||
require.NoError(t, err)
|
assert.Equal(t, "potato", data)
|
||||||
assert.Equal(t, "potato", string(data))
|
|
||||||
|
|
||||||
err = os.Rename(run.path("file2"), run.path("dir/file3"))
|
err = os.Rename(run.path("file2"), run.path("dir/file3"))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
run.checkDir(t, "dir/|dir/file3 6")
|
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)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "potato", string(data))
|
assert.Equal(t, "potato", data)
|
||||||
|
|
||||||
run.rm(t, "dir/file3")
|
run.rm(t, "dir/file3")
|
||||||
run.rmdir(t, "dir")
|
run.rmdir(t, "dir")
|
||||||
|
@ -325,6 +325,7 @@ func (r *Run) readFile(t *testing.T, filepath string) string {
|
|||||||
filepath = r.path(filepath)
|
filepath = r.path(filepath)
|
||||||
result, err := ioutil.ReadFile(filepath)
|
result, err := ioutil.ReadFile(filepath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
time.Sleep(100 * time.Millisecond) // FIXME wait for Release
|
||||||
return string(result)
|
return string(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user