Skip to content

Commit

Permalink
ci: fix objectsuite flakiness
Browse files Browse the repository at this point in the history
objectstore deletion was failing with not found error,
Could Not get resource in k8s -- Failed to run:
kubectl [get -n object-ns CephObjectStore
other-tls-test-store -o json]
So added a check if it not found then donot check its
further condition

Signed-off-by: parth-gr <[email protected]>
(cherry picked from commit 40295a9)
(cherry picked from commit 0e6604d)
  • Loading branch information
parth-gr authored and BlaineEXE committed Nov 21, 2023
1 parent 5d49876 commit 8948597
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/framework/utils/k8s_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions tests/integration/ceph_base_object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"time"

Expand All @@ -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"
)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 8948597

Please sign in to comment.