go-ceph/rados/errors_test.go
John Mulligan 5394d1c99f rados: update error conversion func to be consistent with rbd & cephfs
Rename the getRadosError to getError and update it to match the other
packages behavior.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-06 17:10:09 -04:00

21 lines
389 B
Go

package rados
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRadosError(t *testing.T) {
err := getError(0)
assert.NoError(t, err)
err = getError(-5) // IO error
assert.Error(t, err)
assert.Equal(t, err.Error(), "rados: ret=5, Input/output error")
err = getError(345) // no such errno
assert.Error(t, err)
assert.Equal(t, err.Error(), "rados: ret=345")
}