Skip to content

Commit

Permalink
Merge pull request #785 from zeeke/us/metrics-e2e-fix
Browse files Browse the repository at this point in the history
metrics: Fix `Metrics should have the correct labels` test
  • Loading branch information
ykulazhenkov authored Oct 9, 2024
2 parents 9143c95 + a01a139 commit e35f3d4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions test/conformance/tests/test_exporter_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ var _ = Describe("[sriov] Metrics Exporter", Ordered, ContinueOnFailure, func()
Expect(err).ToNot(HaveOccurred())
waitForNetAttachDef("test-me-network", namespaces.Test)

WaitForSRIOVStable()

DeferCleanup(namespaces.Clean, operatorNamespace, namespaces.Test, clients, discovery.Enabled())
})

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

// sriov_kubepoddevice has a different sets of label than statistics metrics
samples := runPromQLQuery(fmt.Sprintf(`sriov_kubepoddevice{namespace="%s",pod="%s"}`, pod.Namespace, pod.Name))
Expect(samples).ToNot(BeEmpty(), "no value for metric sriov_kubepoddevice")
Expect(samples[0].Metric).To(And(
HaveKey(model.LabelName("pciAddr")),
HaveKeyWithValue(model.LabelName("node"), model.LabelValue(pod.Spec.NodeName)),
HaveKeyWithValue(model.LabelName("dev_type"), model.LabelValue("openshift.io/metricsResource")),
HaveKeyWithValue(model.LabelName("namespace"), model.LabelValue(pod.Namespace)),
HaveKeyWithValue(model.LabelName("pod"), model.LabelValue(pod.Name)),
))
Eventually(func(g Gomega) {
samples := runPromQLQuery(fmt.Sprintf(`sriov_kubepoddevice{namespace="%s",pod="%s"}`, pod.Namespace, pod.Name))
g.Expect(samples).ToNot(BeEmpty(), "no value for metric sriov_kubepoddevice")
g.Expect(samples[0].Metric).To(And(
HaveKey(model.LabelName("pciAddr")),
HaveKeyWithValue(model.LabelName("node"), model.LabelValue(pod.Spec.NodeName)),
HaveKeyWithValue(model.LabelName("dev_type"), model.LabelValue("openshift.io/metricsResource")),
HaveKeyWithValue(model.LabelName("namespace"), model.LabelValue(pod.Namespace)),
HaveKeyWithValue(model.LabelName("pod"), model.LabelValue(pod.Name)),
))
}, "60s", "1s").Should(Succeed())
})
})
})
Expand Down

0 comments on commit e35f3d4

Please sign in to comment.