rbd: fix cleanup of CloneFromGroupSnap test case

When there is a failure during the CloneFromGroupSnap test case, the
rbd-group snapshot was not removed, preventing images from being deleted
as well.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-07-12 18:46:26 +02:00 committed by mergify[bot]
parent 0460442cba
commit 8bced26404

View File

@ -112,6 +112,9 @@ func TestCloneImageByID(t *testing.T) {
t.Run("CloneFromGroupSnap", func(t *testing.T) {
err := GroupSnapCreate(ioctx, gname, "groupsnap")
assert.NoError(t, err)
defer func() {
assert.NoError(t, GroupSnapRemove(ioctx, gname, "groupsnap"))
}()
cloneName := "img-clone"
optionsClone := NewRbdImageOptions()
@ -147,8 +150,5 @@ func TestCloneImageByID(t *testing.T) {
assert.Equal(t, parentInfo.Snap.ID, snapID)
assert.Equal(t, parentInfo.Image.PoolName, poolname)
assert.False(t, parentInfo.Image.Trash)
err = GroupSnapRemove(ioctx, gname, "groupsnap")
assert.NoError(t, err)
})
}