mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 06:15:45 +00:00
Add pod_swap_usage_bytes as an expected metric in e2e test
Use haveKeys() matcher from previous commit to ensure required keys exist. Signed-off-by: Itamar Holder <iholder@redhat.com>
This commit is contained in:
parent
81abfca407
commit
ee82654e39
@ -73,7 +73,7 @@ var _ = SIGDescribe("ResourceMetricsAPI [NodeFeature:ResourceMetrics]", func() {
|
|||||||
memoryCapacity := node.Status.Capacity["memory"]
|
memoryCapacity := node.Status.Capacity["memory"]
|
||||||
memoryLimit := memoryCapacity.Value()
|
memoryLimit := memoryCapacity.Value()
|
||||||
|
|
||||||
matchResourceMetrics := gstruct.MatchAllKeys(gstruct.Keys{
|
matchResourceMetrics := gomega.And(gstruct.MatchKeys(gstruct.IgnoreMissing, gstruct.Keys{
|
||||||
"scrape_error": gstruct.Ignore(),
|
"scrape_error": gstruct.Ignore(),
|
||||||
"node_cpu_usage_seconds_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{
|
"node_cpu_usage_seconds_total": gstruct.MatchAllElements(nodeID, gstruct.Elements{
|
||||||
"": boundedSample(1, 1e6),
|
"": boundedSample(1, 1e6),
|
||||||
@ -106,7 +106,15 @@ var _ = SIGDescribe("ResourceMetricsAPI [NodeFeature:ResourceMetrics]", func() {
|
|||||||
fmt.Sprintf("%s::%s", f.Namespace.Name, pod0): boundedSample(10*e2evolume.Kb, 80*e2evolume.Mb),
|
fmt.Sprintf("%s::%s", f.Namespace.Name, pod0): boundedSample(10*e2evolume.Kb, 80*e2evolume.Mb),
|
||||||
fmt.Sprintf("%s::%s", f.Namespace.Name, pod1): boundedSample(10*e2evolume.Kb, 80*e2evolume.Mb),
|
fmt.Sprintf("%s::%s", f.Namespace.Name, pod1): boundedSample(10*e2evolume.Kb, 80*e2evolume.Mb),
|
||||||
}),
|
}),
|
||||||
})
|
|
||||||
|
"pod_swap_usage_bytes": gstruct.MatchElements(podID, gstruct.IgnoreExtras, gstruct.Elements{
|
||||||
|
fmt.Sprintf("%s::%s", f.Namespace.Name, pod0): boundedSample(0*e2evolume.Kb, 80*e2evolume.Mb),
|
||||||
|
fmt.Sprintf("%s::%s", f.Namespace.Name, pod1): boundedSample(0*e2evolume.Kb, 80*e2evolume.Mb),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
haveKeys("scrape_error", "node_cpu_usage_seconds_total", "node_memory_working_set_bytes", "container_cpu_usage_seconds_total",
|
||||||
|
"container_memory_working_set_bytes", "container_start_time_seconds", "pod_cpu_usage_seconds_total", "pod_memory_working_set_bytes"),
|
||||||
|
)
|
||||||
ginkgo.By("Giving pods a minute to start up and produce metrics")
|
ginkgo.By("Giving pods a minute to start up and produce metrics")
|
||||||
gomega.Eventually(ctx, getResourceMetrics, 1*time.Minute, 15*time.Second).Should(matchResourceMetrics)
|
gomega.Eventually(ctx, getResourceMetrics, 1*time.Minute, 15*time.Second).Should(matchResourceMetrics)
|
||||||
ginkgo.By("Ensuring the metrics match the expectations a few more times")
|
ginkgo.By("Ensuring the metrics match the expectations a few more times")
|
||||||
|
Loading…
Reference in New Issue
Block a user