vfstest: fix crash if open failed

This commit is contained in:
Nick Craig-Wood 2024-06-24 15:37:41 +01:00
parent c1a98768bc
commit 67d4394a37
2 changed files with 3 additions and 2 deletions

View File

@ -15,7 +15,7 @@ func TestWriteFileNoWrite(t *testing.T) {
run.skipIfNoFUSE(t) run.skipIfNoFUSE(t)
fd, err := osCreate(run.path("testnowrite")) fd, err := osCreate(run.path("testnowrite"))
assert.NoError(t, err) require.NoError(t, err)
err = fd.Close() err = fd.Close()
assert.NoError(t, err) assert.NoError(t, err)

View File

@ -8,6 +8,7 @@ import (
"github.com/rclone/rclone/vfs/vfscommon" "github.com/rclone/rclone/vfs/vfscommon"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -20,7 +21,7 @@ func TestWriteFileDoubleClose(t *testing.T) {
} }
out, err := osCreate(run.path("testdoubleclose")) out, err := osCreate(run.path("testdoubleclose"))
assert.NoError(t, err) require.NoError(t, err)
fd := out.Fd() fd := out.Fd()
fd1, err := unix.Dup(int(fd)) fd1, err := unix.Dup(int(fd))