Skip to content

Commit e35f3d4

Browse files
authored
Merge pull request #785 from zeeke/us/metrics-e2e-fix
metrics: Fix `Metrics should have the correct labels` test
2 parents 9143c95 + a01a139 commit e35f3d4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/conformance/tests/test_exporter_metrics.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ var _ = Describe("[sriov] Metrics Exporter", Ordered, ContinueOnFailure, func()
6666
Expect(err).ToNot(HaveOccurred())
6767
waitForNetAttachDef("test-me-network", namespaces.Test)
6868

69+
WaitForSRIOVStable()
70+
6971
DeferCleanup(namespaces.Clean, operatorNamespace, namespaces.Test, clients, discovery.Enabled())
7072
})
7173

@@ -158,15 +160,17 @@ var _ = Describe("[sriov] Metrics Exporter", Ordered, ContinueOnFailure, func()
158160
}, "90s", "1s").Should(Succeed())
159161

160162
// sriov_kubepoddevice has a different sets of label than statistics metrics
161-
samples := runPromQLQuery(fmt.Sprintf(`sriov_kubepoddevice{namespace="%s",pod="%s"}`, pod.Namespace, pod.Name))
162-
Expect(samples).ToNot(BeEmpty(), "no value for metric sriov_kubepoddevice")
163-
Expect(samples[0].Metric).To(And(
164-
HaveKey(model.LabelName("pciAddr")),
165-
HaveKeyWithValue(model.LabelName("node"), model.LabelValue(pod.Spec.NodeName)),
166-
HaveKeyWithValue(model.LabelName("dev_type"), model.LabelValue("openshift.io/metricsResource")),
167-
HaveKeyWithValue(model.LabelName("namespace"), model.LabelValue(pod.Namespace)),
168-
HaveKeyWithValue(model.LabelName("pod"), model.LabelValue(pod.Name)),
169-
))
163+
Eventually(func(g Gomega) {
164+
samples := runPromQLQuery(fmt.Sprintf(`sriov_kubepoddevice{namespace="%s",pod="%s"}`, pod.Namespace, pod.Name))
165+
g.Expect(samples).ToNot(BeEmpty(), "no value for metric sriov_kubepoddevice")
166+
g.Expect(samples[0].Metric).To(And(
167+
HaveKey(model.LabelName("pciAddr")),
168+
HaveKeyWithValue(model.LabelName("node"), model.LabelValue(pod.Spec.NodeName)),
169+
HaveKeyWithValue(model.LabelName("dev_type"), model.LabelValue("openshift.io/metricsResource")),
170+
HaveKeyWithValue(model.LabelName("namespace"), model.LabelValue(pod.Namespace)),
171+
HaveKeyWithValue(model.LabelName("pod"), model.LabelValue(pod.Name)),
172+
))
173+
}, "60s", "1s").Should(Succeed())
170174
})
171175
})
172176
})

0 commit comments

Comments
 (0)