From 40d69e840569ce061dc93f2890bc626860e1c854 Mon Sep 17 00:00:00 2001 From: Coleen Iona Quadros Date: Wed, 4 Sep 2024 14:21:29 +0200 Subject: [PATCH] Fix tests for BVT testing (#1598) * update tests to ignore clusters that dont have observability addon installed Signed-off-by: Coleen Iona Quadros * update tests to ignore clusters that dont have observability addon installed Signed-off-by: Coleen Iona Quadros * force add on obervability label for kind Signed-off-by: Coleen Iona Quadros * add logs to tests Signed-off-by: Coleen Iona Quadros * update Signed-off-by: Coleen Iona Quadros * update Signed-off-by: Coleen Iona Quadros * update Signed-off-by: Coleen Iona Quadros --------- Signed-off-by: Coleen Iona Quadros --- tests/pkg/utils/mco_managedcluster.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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) } }