From f29860a909b4081609af06708458bb5cf1acee52 Mon Sep 17 00:00:00 2001 From: Coleen Iona Quadros Date: Tue, 3 Sep 2024 10:42:36 +0200 Subject: [PATCH] update tests to ignore clusters that dont have observability addon installed Signed-off-by: Coleen Iona Quadros --- tests/pkg/utils/mco_managedcluster.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/pkg/utils/mco_managedcluster.go b/tests/pkg/utils/mco_managedcluster.go index a92b4e2057..a84cff1453 100644 --- a/tests/pkg/utils/mco_managedcluster.go +++ b/tests/pkg/utils/mco_managedcluster.go @@ -53,13 +53,15 @@ func ListManagedClusters(opt TestOptions) ([]string, error) { name := metadata["name"].(string) labels := metadata["labels"].(map[string]interface{}) if labels != nil { - obsControllerStr := "" - if obsController, ok := labels["feature.open-cluster-management.io/addon-observability-controller"]; ok { - obsControllerStr = obsController.(string) - } - if obsControllerStr != "unreachable" { - clusterNames = append(clusterNames, name) + if obsController, ok := labels["feature.open-cluster-management.io/addon-observability-controller"]; !ok { + continue + } else { + obsControllerStr := obsController.(string) + if obsControllerStr != "unreachable" { + clusterNames = append(clusterNames, name) + } } + } }