From d4b6798928a71b661866a79c7101f8d86522ae39 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 12 Dec 2019 15:03:50 -0500 Subject: [PATCH] rados: add test function for error type and functions Signed-off-by: John Mulligan --- rados/rados_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rados/rados_test.go b/rados/rados_test.go index 917c973..e1e3ba0 100644 --- a/rados/rados_test.go +++ b/rados/rados_test.go @@ -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") +}