From 728cf455b97e7cfa73f05b92f0942edd496180bf Mon Sep 17 00:00:00 2001 From: Jacob Baungard Hansen Date: Thu, 19 Dec 2024 14:37:03 +0100 Subject: [PATCH] Various post-merge fixes Fixing initial issues after merge Signed-off-by: Jacob Baungard Hansen --- .../observability-e2e-test_suite_test.go | 2 + tests/pkg/tests/observability_addon_test.go | 20 ++-- tests/pkg/tests/observability_install_test.go | 2 +- .../tests/observability_manifestwork_test.go | 1 - tests/pkg/tests/observability_metrics_test.go | 97 +++++++++---------- tests/pkg/utils/mco_configmaps.go | 1 - tests/pkg/utils/mco_deploy.go | 12 +-- tests/pkg/utils/mco_grafana.go | 1 - tests/pkg/utils/mco_managedcluster.go | 2 - tests/pkg/utils/mco_metric.go | 8 -- 10 files changed, 58 insertions(+), 88 deletions(-) diff --git a/tests/pkg/tests/observability-e2e-test_suite_test.go b/tests/pkg/tests/observability-e2e-test_suite_test.go index 76ededd85..75a4c13bc 100644 --- a/tests/pkg/tests/observability-e2e-test_suite_test.go +++ b/tests/pkg/tests/observability-e2e-test_suite_test.go @@ -9,6 +9,7 @@ import ( "fmt" "math/rand" "os" + "strings" "testing" "time" @@ -145,6 +146,7 @@ var _ = BeforeSuite(func() { var _ = AfterSuite(func() { if !testFailed { uninstallMCO() + } }) func initVars() { diff --git a/tests/pkg/tests/observability_addon_test.go b/tests/pkg/tests/observability_addon_test.go index f5cc45ebc..398417b80 100644 --- a/tests/pkg/tests/observability_addon_test.go +++ b/tests/pkg/tests/observability_addon_test.go @@ -9,8 +9,6 @@ import ( "fmt" "strings" - "errors" - . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -80,16 +78,15 @@ var _ = Describe("Observability:", func() { } return nil }, EventuallyTimeoutMinute*5, EventuallyIntervalSecond*5).Should(Succeed()) - + // TODO: do we need this, disabled in core-automation-repo Eventually(func() error { - err = utils.CheckAllOBADisabled(testOptions) - if err != nil { - return err - } - return nil - }, EventuallyTimeoutMinute*20, EventuallyIntervalSecond*5).Should(Succeed()) - */ + err = utils.CheckAllOBADisabled(testOptions) + if err != nil { + return err + } + return nil + }, EventuallyTimeoutMinute*20, EventuallyIntervalSecond*5).Should(Succeed()) }) // it takes Prometheus 5m to notice a metric is not available - // https://github.com/prometheus/prometheus/issues/1810 @@ -147,6 +144,7 @@ var _ = Describe("Observability:", func() { return nil }, EventuallyTimeoutMinute*15, EventuallyIntervalSecond*5).Should(Succeed()) }) + }) It("RHACM4K-6923: Observability: Verify default scrap interval change to 5 minutes - [P2][Sev2][Observability][Stable]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release @pre-upgrade (addon/g2)", func() { By("Check default interval value is 300") @@ -197,7 +195,7 @@ var _ = Describe("Observability:", func() { }, EventuallyTimeoutMinute*5, EventuallyIntervalSecond*5).Should(BeTrue()) } }) - + Context("RHACM4K-7518: Observability: Disable the Observability by updating managed cluster label [P2][Sev2][Observability]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore (addon/g1) -", func() { It("[Stable] Modifying managedcluster cr to disable observability", func() { Eventually(func() error { diff --git a/tests/pkg/tests/observability_install_test.go b/tests/pkg/tests/observability_install_test.go index 2b65eea0d..95bbd5b93 100644 --- a/tests/pkg/tests/observability_install_test.go +++ b/tests/pkg/tests/observability_install_test.go @@ -36,7 +36,7 @@ func installMCO() { testOptions.HubCluster.ClusterServerURL, testOptions.KubeConfig, testOptions.HubCluster.KubeContext) - + // TODO (jacob): The test RHACM4K-30645 depends on the below. Should that test maybe be moved here? By("Deploy CM cluster-monitoring-config") diff --git a/tests/pkg/tests/observability_manifestwork_test.go b/tests/pkg/tests/observability_manifestwork_test.go index 636002a4d..ac7497a42 100644 --- a/tests/pkg/tests/observability_manifestwork_test.go +++ b/tests/pkg/tests/observability_manifestwork_test.go @@ -32,7 +32,6 @@ var _ = Describe("Observability:", func() { } }) - Context("[P2][Sev2][observability][Stable] Should be automatically created within 1 minute when delete manifestwork @ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release (manifestwork/g0) -", func() { manifestWorkName := "endpoint-observability-work" clientDynamic := utils.GetKubeClientDynamic(testOptions, true) diff --git a/tests/pkg/tests/observability_metrics_test.go b/tests/pkg/tests/observability_metrics_test.go index 550984ab9..deae1d758 100644 --- a/tests/pkg/tests/observability_metrics_test.go +++ b/tests/pkg/tests/observability_metrics_test.go @@ -50,35 +50,32 @@ var _ = Describe("Observability:", func() { }, EventuallyTimeoutMinute*6, EventuallyIntervalSecond*5).Should(Succeed()) }) - It("RHACM4K-1449 - Observability - Verify metrics data consistency [P2][Sev2][Observability][Integration]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release @pre-upgrade (metrics/g1)", func() { - metricList := utils.GetDefaultMetricList(testOptions) - _, etcdPodList := utils.GetPodList( - testOptions, - true, - "openshift-etcd", - "app=etcd", - ) - // ignore etcd network peer metrics for SNO cluster - if etcdPodList != nil && len(etcdPodList.Items) <= 0 { - ignoreMetricMap["etcd_network_peer_received_bytes_total"] = true - ignoreMetricMap["etcd_network_peer_sent_bytes_total"] = true - } - for _, name := range metricList { - if _, ok := ignoredMetrics[name]; ok { - continue - } - - Eventually(func() error { - res, err := utils.QueryGrafana(testOptions, query) - if err != nil { - return err - } - if len(res.Data.Result) == 0 { - return fmt.Errorf("no data found for %s", query) - } - }, EventuallyTimeoutMinute*2, EventuallyIntervalSecond*3).Should(Succeed()) - } - }) + // TODO (jacob): exact same as RHACM4K-3339?? + // It("RHACM4K-1449 - Observability - Verify metrics data consistency [P2][Sev2][Observability][Integration]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release @pre-upgrade (metrics/g1)", func() { + // metricList := utils.GetDefaultMetricList(testOptions) + // _, etcdPodList := utils.GetPodList( + // testOptions, + // true, + // "openshift-etcd", + // "app=etcd", + // ) + // + // for _, name := range metricList { + // if _, ok := ignoredMetrics[name]; ok { + // continue + // } + // + // Eventually(func() error { + // res, err := utils.QueryGrafana(testOptions, query) + // if err != nil { + // return err + // } + // if len(res.Data.Result) == 0 { + // return fmt.Errorf("no data found for %s", query) + // } + // }, EventuallyTimeoutMinute*2, EventuallyIntervalSecond*3).Should(Succeed()) + // } + // }) It("RHACM4K-1658: Observability: Customized metrics data are collected [P2][Sev2][Observability][Integration]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release @pre-upgrade (metrics/g0)", func() { By("Adding custom metrics allowlist configmap") @@ -249,34 +246,30 @@ var _ = Describe("Observability:", func() { return nil }, EventuallyTimeoutMinute*1, EventuallyIntervalSecond*5).Should(Succeed()) + } + }) It("RHACM4K-3339: Observability: Verify recording rule - Should have metrics which used grafana dashboard [P2][Sev2][Observability][Integration]@ocpInterop @non-ui-post-restore @non-ui-post-release @non-ui-pre-upgrade @non-ui-post-upgrade @post-upgrade @post-restore @e2e @post-release @pre-upgrade (ssli/g1)", func() { - metricList := utils.GetDefaultMetricList(testOptions) - _, etcdPodList := utils.GetPodList( - testOptions, - true, - "openshift-etcd", - "app=etcd", - ) - // ignore etcd network peer metrics for SNO cluster - if etcdPodList != nil && len(etcdPodList.Items) <= 0 { - ignoreMetricMap["etcd_network_peer_received_bytes_total"] = true - ignoreMetricMap["etcd_network_peer_sent_bytes_total"] = true - } + metricList, _ := utils.GetDefaultMetricList(testOptions) + for _, name := range metricList { - _, ok := ignoreMetricMap[name] - if !ok { - Eventually(func() error { - res, err := utils.QueryGrafana(testOptions, query) - if err != nil { - return err - } - if len(res.Data.Result) == 0 { - return fmt.Errorf("no data found for %s", query) - } - }, EventuallyTimeoutMinute*2, EventuallyIntervalSecond*3).Should(Succeed()) + if _, ok := ignoredMetrics[name]; ok { + continue } + + Eventually(func() error { + query := fmt.Sprintf("%s", name) + res, err := utils.QueryGrafana(testOptions, query) + + if err != nil { + return err + } + if len(res.Data.Result) == 0 { + return fmt.Errorf("no data found for %s", query) + } + return nil + }, EventuallyTimeoutMinute*2, EventuallyIntervalSecond*3).Should(Succeed()) } }) diff --git a/tests/pkg/utils/mco_configmaps.go b/tests/pkg/utils/mco_configmaps.go index 80a2e86cb..5ec376848 100644 --- a/tests/pkg/utils/mco_configmaps.go +++ b/tests/pkg/utils/mco_configmaps.go @@ -8,7 +8,6 @@ import ( "context" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/klog" ) diff --git a/tests/pkg/utils/mco_deploy.go b/tests/pkg/utils/mco_deploy.go index a5d028593..a44dd8a41 100644 --- a/tests/pkg/utils/mco_deploy.go +++ b/tests/pkg/utils/mco_deploy.go @@ -6,16 +6,9 @@ package utils import ( "context" -<<<<<<< HEAD "encoding/json" "errors" "fmt" -======= - b64 "encoding/base64" - "encoding/json" - "fmt" - "io/ioutil" ->>>>>>> core-automation/main "os" "path/filepath" "reflect" @@ -27,10 +20,7 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer/yaml" -<<<<<<< HEAD "k8s.io/client-go/dynamic" -======= ->>>>>>> core-automation/main "k8s.io/klog" ) @@ -468,7 +458,7 @@ func RevertMCOCRModification(opt TestOptions) error { return nil } -unc CheckMCOAddonResources(opt TestOptions) error { +func CheckMCOAddonResources(opt TestOptions) error { client := NewKubeClient( opt.HubCluster.ClusterServerURL, opt.KubeConfig, diff --git a/tests/pkg/utils/mco_grafana.go b/tests/pkg/utils/mco_grafana.go index fae63ec7a..3a864629d 100644 --- a/tests/pkg/utils/mco_grafana.go +++ b/tests/pkg/utils/mco_grafana.go @@ -5,7 +5,6 @@ package utils import ( - "fmt" "io/ioutil" "os" "strings" diff --git a/tests/pkg/utils/mco_managedcluster.go b/tests/pkg/utils/mco_managedcluster.go index 796203dba..ba1eb9ac2 100644 --- a/tests/pkg/utils/mco_managedcluster.go +++ b/tests/pkg/utils/mco_managedcluster.go @@ -5,10 +5,8 @@ package utils import ( - "context" "errors" - "fmt" "os" goversion "github.com/hashicorp/go-version" diff --git a/tests/pkg/utils/mco_metric.go b/tests/pkg/utils/mco_metric.go index dff82f25f..763671a08 100644 --- a/tests/pkg/utils/mco_metric.go +++ b/tests/pkg/utils/mco_metric.go @@ -5,18 +5,10 @@ package utils import ( -<<<<<<< HEAD "context" "crypto/tls" "fmt" "io" -======= - "bufio" - "context" - "crypto/tls" - "fmt" - "io/ioutil" ->>>>>>> core-automation/main "net/http" "net/url" "os"