rados: add test function for error type and functions

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2019-12-12 15:03:50 -05:00 committed by Niels de Vos
parent 105ccc6ee1
commit d4b6798928
1 changed files with 13 additions and 0 deletions

View File

@ -1136,3 +1136,16 @@ func (suite *RadosTestSuite) TestOmapOnNonexistentObjectError() {
func TestRadosTestSuite(t *testing.T) {
suite.Run(t, new(RadosTestSuite))
}
func TestRadosError(t *testing.T) {
err := GetRadosError(0)
assert.NoError(t, err)
err = GetRadosError(-5) // IO error
assert.Error(t, err)
assert.Equal(t, err.Error(), "rados: ret=5, Input/output error")
err = GetRadosError(345) // no such errno
assert.Error(t, err)
assert.Equal(t, err.Error(), "rados: ret=345")
}