From 2a1ca2dead1550df72d2a44d1c42a501fc315734 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Mon, 19 Aug 2024 17:02:14 +0530 Subject: [PATCH] rbd: Remove invalid snap ID test skip Fix for https://tracker.ceph.com/issues/47287 is now available with quincy and above releases. Therefore do not skip GetSnapTimestamp API test for an invalid snap ID. Signed-off-by: Anoop C S --- rbd/snapshot_test.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/rbd/snapshot_test.go b/rbd/snapshot_test.go index 6cc7442de..310e11e08 100644 --- a/rbd/snapshot_test.go +++ b/rbd/snapshot_test.go @@ -1,12 +1,33 @@ package rbd import ( + "os" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +var ( + serverVersion string +) + +const ( + cephOctopus = "octopus" + cephPacfic = "pacific" + cephQuincy = "quincy" + cephReef = "reef" + cephSquid = "squid" + cephMain = "main" +) + +func init() { + switch vname := os.Getenv("CEPH_VERSION"); vname { + case cephOctopus, cephPacfic, cephQuincy, cephReef, cephSquid, cephMain: + serverVersion = vname + } +} + func TestCreateSnapshot(t *testing.T) { conn := radosConnect(t) @@ -138,7 +159,11 @@ func TestGetSnapTimestamp(t *testing.T) { }) t.Run("invalidSnapID", func(t *testing.T) { - t.Skip("hits assert due to https://tracker.ceph.com/issues/47287") + switch serverVersion { + case cephOctopus, cephPacfic: + t.Skip("hits assert due to https://tracker.ceph.com/issues/47287") + } + imgName := "someImage" img, err := Create(ioctx, imgName, testImageSize, testImageOrder, 1) assert.NoError(t, err) @@ -156,6 +181,7 @@ func TestGetSnapTimestamp(t *testing.T) { snapID = 22 _, err = img.GetSnapTimestamp(snapID) assert.Error(t, err) + assert.Equal(t, err, ErrNotFound) }) t.Run("happyPath", func(t *testing.T) {