PSI test: add a CPU limit of 500m to cpu-stress-pod

The goal is to generate CPU pressure more reliably, especially when the node has plenty of CPUs.
This commit is contained in:
Haowei Cai
2025-08-11 18:14:28 +00:00
parent b4b973c237
commit ea9d7ff865

View File

@@ -381,7 +381,16 @@ var _ = SIGDescribe("Summary API", framework.WithNodeConformance(), func() {
ginkgo.It("should report CPU pressure in PSI metrics", func(ctx context.Context) {
podName := "cpu-pressure-pod"
ginkgo.By("Creating a pod to generate CPU pressure")
pod := e2epod.NewPodClient(f).Create(ctx, getStressTestPod(podName, "cpu-stress", []string{"stress", "--cpus", "1"}))
podSpec := getStressTestPod(podName, "cpu-stress", []string{"stress", "--cpus", "1"})
podSpec.Spec.Containers[0].Resources = v1.ResourceRequirements{
Limits: v1.ResourceList{
v1.ResourceCPU: resource.MustParse("500m"),
},
Requests: v1.ResourceList{
v1.ResourceCPU: resource.MustParse("500m"),
},
}
pod := e2epod.NewPodClient(f).Create(ctx, podSpec)
ginkgo.By("Waiting for the pod to start")
framework.ExpectNoError(e2epod.WaitForPodRunningInNamespace(ctx, f.ClientSet, pod))