rbd: update TestReadAt to use new approach for create & open

Update the TestReadAt function to use the new CreateImage and OpenImage
functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-01-24 10:59:46 -05:00 committed by John Mulligan
parent 1842bd74e6
commit 4691e0cb4c
1 changed files with 7 additions and 3 deletions

View File

@ -631,10 +631,14 @@ func TestReadAt(t *testing.T) {
require.NoError(t, err)
name := GetUUID()
img, err := Create(ioctx, name, testImageSize, testImageOrder)
options := NewRbdImageOptions()
defer options.Destroy()
err = options.SetUint64(RbdImageOptionOrder, uint64(testImageOrder))
assert.NoError(t, err)
err = CreateImage(ioctx, name, testImageSize, options)
require.NoError(t, err)
err = img.Open()
img, err := OpenImage(ioctx, name, NoSnapshot)
assert.NoError(t, err)
// write 0 bytes should succeed
@ -677,7 +681,7 @@ func TestReadAt(t *testing.T) {
assert.NoError(t, err)
// writing to a read-only image should fail
err = img.Open(true)
img, err = OpenImageReadOnly(ioctx, name, NoSnapshot)
assert.NoError(t, err)
_, err = img.WriteAt(data_out, 256)