Skip to content

Commit

Permalink
cephfs: made ENOENT a public error
Browse files Browse the repository at this point in the history
this commit renames ErrNoEntry of cephfs
to ErrNotExist and making it public allowing
other projects to access this.

Signed-off-by: Riya Singhal <rsinghal@redhat.com>
  • Loading branch information
riya-singhal31 authored and mergify[bot] committed Nov 9, 2023
1 parent 51b8287 commit 2852a13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cephfs/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ const (
// ErrNotConnected may be returned when client is not connected
// to a cluster.
ErrNotConnected = cephFSError(-C.ENOTCONN)
// ErrNotExist indicates a non-specific missing resource.
ErrNotExist = cephFSError(-C.ENOENT)
)

// Private errors:

const (
errInvalid = cephFSError(-C.EINVAL)
errNameTooLong = cephFSError(-C.ENAMETOOLONG)
errNoEntry = cephFSError(-C.ENOENT)
errRange = cephFSError(-C.ERANGE)
)
4 changes: 2 additions & 2 deletions cephfs/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestRemoveDir(t *testing.T) {
assert.NoError(t, err)

_, err = mount.Statx(dirname, StatxBasicStats, 0)
assert.Equal(t, err, errNoEntry)
assert.Equal(t, err, ErrNotExist)
}

func TestLink(t *testing.T) {
Expand Down Expand Up @@ -367,7 +367,7 @@ func TestStatx(t *testing.T) {
st, err = mount.Statx(dirname, StatxBasicStats, 0)
assert.Error(t, err)
assert.Nil(t, st)
assert.Equal(t, errNoEntry, err)
assert.Equal(t, ErrNotExist, err)
})

t.Run("invalidMount", func(t *testing.T) {
Expand Down

0 comments on commit 2852a13

Please sign in to comment.