sysfs: consolidates errno coersion and maps EAGAIN and EINTR (#1113)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-02-09 19:50:05 -10:00
committed by GitHub
parent e2fde2500e
commit 882b764437
16 changed files with 289 additions and 269 deletions

View File

@@ -71,6 +71,11 @@ func TestDirFS_MkDir(t *testing.T) {
err := testFS.Mkdir(name, fs.ModeDir)
require.Equal(t, syscall.EEXIST, err)
})
t.Run("try creating on file", func(t *testing.T) {
filePath := pathutil.Join("non-existing-dir", "foo.txt")
err := testFS.Mkdir(filePath, fs.ModeDir)
require.Equal(t, syscall.ENOENT, err)
})
}
func TestDirFS_Rename(t *testing.T) {
@@ -577,8 +582,8 @@ func TestDirFS_Readlink(t *testing.T) {
buf := make([]byte, 200)
for _, tl := range testLinks {
err := os.Symlink(pathutil.Join(tl.old), pathutil.Join(tmpDir, tl.dst))
require.NoError(t, err)
err := testFS.Symlink(tl.old, tl.dst) // not os.Symlink for windows compat
require.NoError(t, err, "%v", tl)
n, err := testFS.Readlink(tl.dst, buf)
require.NoError(t, err)