test/rbd: add test for Image.Rename()

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2019-12-10 10:49:14 +01:00 committed by John Mulligan
parent 65d1e9c763
commit 0b8f4eb7e5
1 changed files with 29 additions and 0 deletions

View File

@ -226,6 +226,35 @@ func TestGetImageNames(t *testing.T) {
conn.Shutdown()
}
func TestImageRename(t *testing.T) {
conn, _ := rados.NewConn()
conn.ReadDefaultConfigFile()
conn.Connect()
poolname := GetUUID()
err := conn.MakePool(poolname)
assert.NoError(t, err)
ioctx, err := conn.OpenIOContext(poolname)
require.NoError(t, err)
name := GetUUID()
img, err := Create(ioctx, name, 1<<22, 22)
assert.NoError(t, err)
err = img.Rename(name)
assert.Error(t, err)
err = img.Rename(GetUUID())
assert.NoError(t, err)
img.Remove()
ioctx.Destroy()
conn.DeletePool(poolname)
conn.Shutdown()
}
func TestIOReaderWriter(t *testing.T) {
conn, _ := rados.NewConn()
conn.ReadDefaultConfigFile()