2020-03-30 20:02:07 +00:00
|
|
|
package rados
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRadosError(t *testing.T) {
|
2020-03-30 20:57:54 +00:00
|
|
|
err := getError(0)
|
2020-03-30 20:02:07 +00:00
|
|
|
assert.NoError(t, err)
|
|
|
|
|
2020-03-30 20:57:54 +00:00
|
|
|
err = getError(-5) // IO error
|
2020-03-30 20:02:07 +00:00
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Equal(t, err.Error(), "rados: ret=5, Input/output error")
|
|
|
|
|
2020-03-30 20:57:54 +00:00
|
|
|
err = getError(345) // no such errno
|
2020-03-30 20:02:07 +00:00
|
|
|
assert.Error(t, err)
|
|
|
|
assert.Equal(t, err.Error(), "rados: ret=345")
|
|
|
|
}
|