rbd: convert test to use errors with conventional names

We recently created errors in the rbd that match the golang convention
but left aliases for external code. Switch the test code to use the
newer more standard form instead of the "aliases."

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2019-12-13 11:12:17 -05:00 committed by Niels de Vos
parent 36fc3510d8
commit 7c1e4f2ca9
1 changed files with 22 additions and 22 deletions

View File

@ -449,64 +449,64 @@ func TestErrorImageNotOpen(t *testing.T) {
image := rbd.GetImage(nil, "nonexistent")
err := image.Close()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
err = image.Resize(2 << 22)
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.Stat()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.IsOldFormat()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.GetSize()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.GetFeatures()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.GetStripeUnit()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.GetStripeCount()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.GetOverlap()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
err = image.Flatten()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, _, err = image.ListChildren()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, _, err = image.ListLockers()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
err = image.LockExclusive("a magic cookie")
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
err = image.LockShared("a magic cookie", "tasty")
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
err = image.BreakLock("a magic cookie", "tasty")
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.Read(nil)
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.Write(nil)
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.ReadAt(nil, 0)
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
_, err = image.WriteAt(nil, 0)
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
err = image.Flush()
assert.Equal(t, err, rbd.RbdErrorImageNotOpen)
assert.Equal(t, err, rbd.ErrImageNotOpen)
}
func TestNotFound(t *testing.T) {
@ -525,10 +525,10 @@ func TestNotFound(t *testing.T) {
img := rbd.GetImage(ioctx, name)
err = img.Open()
assert.Equal(t, err, rbd.RbdErrorNotFound)
assert.Equal(t, err, rbd.ErrNotFound)
err = img.Remove()
assert.Equal(t, err, rbd.RbdErrorNotFound)
assert.Equal(t, err, rbd.ErrNotFound)
ioctx.Destroy()
conn.DeletePool(poolname)