diff --git a/tests/pkg/utils/mco_managedcluster.go b/tests/pkg/utils/mco_managedcluster.go index a92b4e205..9e96ffe4b 100644 --- a/tests/pkg/utils/mco_managedcluster.go +++ b/tests/pkg/utils/mco_managedcluster.go @@ -7,6 +7,7 @@ package utils import ( "context" "errors" + "os" goversion "github.com/hashicorp/go-version" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -52,12 +53,13 @@ func ListManagedClusters(opt TestOptions) ([]string, error) { metadata := obj.Object["metadata"].(map[string]interface{}) name := metadata["name"].(string) labels := metadata["labels"].(map[string]interface{}) + if os.Getenv("IS_KIND_ENV") == "true" { + // We do not have the obs add on label added in kind cluster + clusterNames = append(clusterNames, name) + continue + } if labels != nil { - obsControllerStr := "" - if obsController, ok := labels["feature.open-cluster-management.io/addon-observability-controller"]; ok { - obsControllerStr = obsController.(string) - } - if obsControllerStr != "unreachable" { + if obsController, ok := labels["feature.open-cluster-management.io/addon-observability-controller"]; ok && obsController.(string) != "unreachable" { clusterNames = append(clusterNames, name) } }