-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Func Test: Don't verify Operator Health Metric (#3262)
This check is flaky. Temporary remove this check to make the test more stable, while looking for alternative check in order to verify the operator health metric. Signed-off-by: Nahshon Unna-Tsameret <[email protected]>
- Loading branch information
Showing
1 changed file
with
6 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:[email protected]][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:[email protected]][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:[email protected]][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:[email protected]][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:[email protected]][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:[email protected]][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()) | ||
|