diff --git a/tests/func-tests/monitoring_test.go b/tests/func-tests/monitoring_test.go index 803e6f2fb..547d39b41 100644 --- a/tests/func-tests/monitoring_test.go +++ b/tests/func-tests/monitoring_test.go @@ -32,7 +32,6 @@ import ( kubevirtcorev1 "kubevirt.io/api/core/v1" hcoalerts "github.com/kubevirt/hyperconverged-cluster-operator/pkg/monitoring/rules/alerts" - "github.com/kubevirt/hyperconverged-cluster-operator/pkg/monitoring/rules/recordingrules" hcoutil "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util" tests "github.com/kubevirt/hyperconverged-cluster-operator/tests/func-tests" ) @@ -43,13 +42,12 @@ var _ = Describe("[crit:high][vendor:cnv-qe@redhat.com][level:system]Monitoring" flag.Parse() var ( - cli client.Client - cliSet *kubernetes.Clientset - restClient rest.Interface - promClient promApiv1.API - prometheusRule monitoringv1.PrometheusRule - initialOperatorHealthMetricValue float64 - hcoClient *tests.HCOPrometheusClient + cli client.Client + cliSet *kubernetes.Clientset + restClient rest.Interface + promClient promApiv1.API + prometheusRule monitoringv1.PrometheusRule + hcoClient *tests.HCOPrometheusClient ) runbookClient.Timeout = time.Second * 3 @@ -67,7 +65,6 @@ var _ = Describe("[crit:high][vendor:cnv-qe@redhat.com][level:system]Monitoring" hcoClient, err = tests.GetHCOPrometheusClient(ctx, cli) Expect(err).NotTo(HaveOccurred()) - initialOperatorHealthMetricValue = getMetricValue(ctx, promClient, "kubevirt_hyperconverged_operator_health_status") Expect(err).NotTo(HaveOccurred()) }) @@ -165,8 +162,6 @@ var _ = Describe("[crit:high][vendor:cnv-qe@redhat.com][level:system]Monitoring" alert := getAlertByName(alerts, "KubeVirtCRModified") return alert }).WithTimeout(60 * time.Second).WithPolling(time.Second).WithContext(ctx).ShouldNot(BeNil()) - - verifyOperatorHealthMetricValue(ctx, promClient, initialOperatorHealthMetricValue, recordingrules.WarningImpact) }) It("UnsupportedHCOModification alert should fired when there is an jsonpatch annotation to modify an operand CRs", func(ctx context.Context) { @@ -184,7 +179,6 @@ var _ = Describe("[crit:high][vendor:cnv-qe@redhat.com][level:system]Monitoring" alert := getAlertByName(alerts, "UnsupportedHCOModification") return alert }).WithTimeout(60 * time.Second).WithPolling(time.Second).WithContext(ctx).ShouldNot(BeNil()) - verifyOperatorHealthMetricValue(ctx, promClient, initialOperatorHealthMetricValue, recordingrules.WarningImpact) }) Describe("KubeDescheduler", Serial, Ordered, Label(tests.OpenshiftLabel, "monitoring"), func() { @@ -288,8 +282,6 @@ var _ = Describe("[crit:high][vendor:cnv-qe@redhat.com][level:system]Monitoring" return alert }).WithTimeout(60 * time.Second).WithPolling(time.Second).WithContext(ctx).ShouldNot(BeNil()) - verifyOperatorHealthMetricValue(ctx, promClient, initialOperatorHealthMetricValue, recordingrules.CriticalImpact) - By("Correctly configuring the descheduler for KubeVirt") Expect(cli.Patch(ctx, descheduler, patchConfigure)).To(Succeed()) By("checking that the metric doesn't report it as misconfigured (0.0)") @@ -361,8 +353,6 @@ var _ = Describe("[crit:high][vendor:cnv-qe@redhat.com][level:system]Monitoring" alert := getAlertByName(alerts, hcoalerts.MisconfiguredDeschedulerAlert) return alert }).WithTimeout(60 * time.Second).WithPolling(time.Second).WithContext(ctx).ShouldNot(BeNil()) - - verifyOperatorHealthMetricValue(ctx, promClient, initialOperatorHealthMetricValue, recordingrules.CriticalImpact) }) }) @@ -377,15 +367,6 @@ func getAlertByName(alerts promApiv1.AlertsResult, alertName string) *promApiv1. return nil } -func verifyOperatorHealthMetricValue(ctx context.Context, promClient promApiv1.API, initialOperatorHealthMetricValue, alertImpact float64) { - Eventually(func(g Gomega, ctx context.Context) { - if alertImpact >= initialOperatorHealthMetricValue { - operatorHealthMetricValue := getMetricValue(ctx, promClient, "kubevirt_hyperconverged_operator_health_status") - g.Expect(operatorHealthMetricValue).To(Equal(alertImpact)) - } - }).WithTimeout(60 * time.Second).WithPolling(5 * time.Second).WithContext(ctx).Should(Succeed()) -} - func getMetricValue(ctx context.Context, promClient promApiv1.API, metricName string) float64 { queryResult, _, err := promClient.Query(ctx, metricName, time.Now()) ExpectWithOffset(1, err).ToNot(HaveOccurred())