From cf21dcef5137cc9b9b1e3bf4e0b32f800ab680eb Mon Sep 17 00:00:00 2001 From: Swati Sehgal Date: Thu, 2 Feb 2023 12:19:09 +0000 Subject: [PATCH] node: topology-mgr: e2e: changes to validate admission latency metrics The component was previously incorrect. This patch updates to the correct component name. Signed-off-by: Swati Sehgal --- .../e2e_node/topology_manager_metrics_test.go | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/e2e_node/topology_manager_metrics_test.go b/test/e2e_node/topology_manager_metrics_test.go index 84e1eadb32c..2af49d709e1 100644 --- a/test/e2e_node/topology_manager_metrics_test.go +++ b/test/e2e_node/topology_manager_metrics_test.go @@ -23,6 +23,7 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" "github.com/onsi/gomega/gstruct" + "github.com/onsi/gomega/types" v1 "k8s.io/api/core/v1" kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config" @@ -85,6 +86,9 @@ var _ = SIGDescribe("Topology Manager Metrics [Serial][Feature:TopologyManager]" "kubelet_topology_manager_admission_errors_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{ "": timelessSample(0), }), + "kubelet_topology_manager_admission_duration_ms_count": gstruct.MatchElements(nodeID, gstruct.IgnoreExtras, gstruct.Elements{ + "": timelessSample(0), + }), }) ginkgo.By("Giving the Kubelet time to start up and produce metrics") @@ -108,6 +112,9 @@ var _ = SIGDescribe("Topology Manager Metrics [Serial][Feature:TopologyManager]" "kubelet_topology_manager_admission_errors_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{ "": timelessSample(1), }), + "kubelet_topology_manager_admission_duration_ms_count": gstruct.MatchElements(nodeID, gstruct.IgnoreExtras, gstruct.Elements{ + "": checkMetricValueGreaterThan(0), + }), }) ginkgo.By("Giving the Kubelet time to start up and produce metrics") @@ -122,7 +129,7 @@ var _ = SIGDescribe("Topology Manager Metrics [Serial][Feature:TopologyManager]" // we updated the kubelet config in BeforeEach, so we can assume we start fresh. // being [Serial], we can also assume noone else but us is running pods. - ginkgo.By("Checking the cpumanager metrics right after the kubelet restart, with pod should be admitted") + ginkgo.By("Checking the topologymanager metrics right after the kubelet restart, with pod should be admitted") matchResourceMetrics := gstruct.MatchKeys(gstruct.IgnoreExtras, gstruct.Keys{ "kubelet_topology_manager_admission_requests_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{ @@ -131,6 +138,9 @@ var _ = SIGDescribe("Topology Manager Metrics [Serial][Feature:TopologyManager]" "kubelet_topology_manager_admission_errors_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{ "": timelessSample(0), }), + "kubelet_topology_manager_admission_duration_ms_count": gstruct.MatchElements(nodeID, gstruct.IgnoreExtras, gstruct.Elements{ + "": checkMetricValueGreaterThan(0), + }), }) ginkgo.By("Giving the Kubelet time to start up and produce metrics") @@ -157,3 +167,12 @@ func hostCheck() (int, int) { return numaNodes, coreCount } + +func checkMetricValueGreaterThan(value interface{}) types.GomegaMatcher { + return gstruct.PointTo(gstruct.MatchAllFields(gstruct.Fields{ + // We already check Metric when matching the Id + "Metric": gstruct.Ignore(), + "Value": gomega.BeNumerically(">", value), + "Timestamp": gstruct.Ignore(), + })) +}