From add4c02df15b3900e5fa0150cdfc08dc7922e4b5 Mon Sep 17 00:00:00 2001 From: Jacques Massa Date: Fri, 25 Oct 2024 18:09:19 -0400 Subject: [PATCH] check condition in one line --- test/e2e/framework/prometheus/prometheus.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/e2e/framework/prometheus/prometheus.go b/test/e2e/framework/prometheus/prometheus.go index c9c781dc69..3041d776cf 100644 --- a/test/e2e/framework/prometheus/prometheus.go +++ b/test/e2e/framework/prometheus/prometheus.go @@ -85,10 +85,8 @@ func verifyValidMetricPresent(metricName string, data map[string]*promclient.Met } // if valid metric is empty, then we just need to make sure the metric and value is present - if len(validMetric) == 0 { - if len(metricLabels) > 0 { - return nil - } + if len(validMetric) == 0 && len(metricLabels) > 0 { + return nil } if reflect.DeepEqual(metricLabels, validMetric) {