diff --git a/tests/framework/utils/k8s_helper.go b/tests/framework/utils/k8s_helper.go index c90c42de161c..c69b06dd4a0f 100644 --- a/tests/framework/utils/k8s_helper.go +++ b/tests/framework/utils/k8s_helper.go @@ -297,7 +297,7 @@ func (k8sh *K8sHelper) GetResource(args ...string) (string, error) { if err == nil { return result, nil } - return "", fmt.Errorf("Could Not get resource in k8s -- %v", err) + return result, fmt.Errorf("Could Not get resource in k8s -- %v", err) } func (k8sh *K8sHelper) CreateNamespace(namespace string) error { diff --git a/tests/integration/ceph_base_object_test.go b/tests/integration/ceph_base_object_test.go index e0620fb1da31..ae905786cee4 100644 --- a/tests/integration/ceph_base_object_test.go +++ b/tests/integration/ceph_base_object_test.go @@ -23,6 +23,7 @@ import ( "os" "path/filepath" "strconv" + "strings" "testing" "time" @@ -35,6 +36,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" ) @@ -192,6 +194,12 @@ func assertObjectStoreDeletion(t *testing.T, k8sh *utils.K8sHelper, namespace, s sleepTime := 3 * time.Second for i = 0; i < retry; i++ { storeStr, err := k8sh.GetResource("-n", namespace, "CephObjectStore", storeName, "-o", "json") + // if cephobjectstore is not found, just return the test + // no need to check deletion phases as it is already deleted + if err != nil && strings.Contains(storeStr, errors.NewNotFound(v1.Resource("cephobjectstores.ceph.rook.io"), storeName).ErrStatus.Message) { + return + } + assert.NoError(t, err) logger.Infof("store: \n%s", storeStr)