Skip to content

Commit eacfe9f

Browse files
mrniranjanNiranjan M.R
andauthored
OCPBUGS-59354: E2E add test to verify guaranteed pod is running after kubelet restart (#1361)
* verify Guranteed pod is running after kubelet restart This PR addresses issue where we are verifying if the cpu manager state file is same after kubelet restart while we are verifying the above, we are not checking if Guranteed pod started before kubelet restart is also still running. Refer: https://issues.redhat.com/browse/OCPBUGS-43280 Signed-off-by: Niranjan M.R <mrniranjan@redhat.com> * avoid using indirect references and test negative pod status condition Signed-off-by: Niranjan M.R <mrniranjan@redhat.com> * typo fix and add more debug when pod fails Signed-off-by: Niranjan M.R <mrniranjan@redhat.com> --------- Signed-off-by: Niranjan M.R <mrniranjan@redhat.com> Co-authored-by: Niranjan M.R <mrniranjan@redhat.com>
1 parent 4f5c8b9 commit eacfe9f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/e2e/performanceprofile/functests/1_performance/cpu_management.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() {
346346
cpuManagerCpusetBeforeRestart, err := nodes.CpuManagerCpuSet(ctx, workerRTNode)
347347
Expect(err).ToNot(HaveOccurred())
348348
testlog.Infof("pre kubelet restart default cpuset: %v", cpuManagerCpusetBeforeRestart.String())
349+
350+
By("capturing test pod state before restart")
351+
originalPodUID := testpod.UID
352+
testlog.Infof("pre kubelet restart pod UID: %v", originalPodUID)
353+
349354
kubeletRestartCmd := []string{
350355
"chroot",
351356
"/rootfs",
@@ -362,6 +367,33 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() {
362367

363368
testlog.Infof("post restart: finished cooldown time: %v", restartCooldownTime)
364369

370+
By("verify test pod comes back after kubelet restart")
371+
Eventually(func() error {
372+
var updatedPod corev1.Pod
373+
err := testclient.DataPlaneClient.Get(ctx, client.ObjectKeyFromObject(testpod), &updatedPod)
374+
if err != nil {
375+
return fmt.Errorf("failed to get pod after restart: %v", err)
376+
}
377+
378+
// Verify it's the same pod (same UID)
379+
if updatedPod.UID != originalPodUID {
380+
return fmt.Errorf("pod UID changed after restart: original=%v, current=%v", originalPodUID, updatedPod.UID)
381+
}
382+
383+
// Verify pod is ready
384+
if updatedPod.Status.Phase != corev1.PodRunning {
385+
return fmt.Errorf("pod is not running after restart: phase=%v", updatedPod.Status.Phase)
386+
}
387+
// Check pod ready condition
388+
for _, condition := range updatedPod.Status.Conditions {
389+
if condition.Type == corev1.PodReady && condition.Status != corev1.ConditionTrue {
390+
return fmt.Errorf("Pod condition is not in Ready state after kubelet restart: reason: %v, message: %v", condition.Reason, condition.Message)
391+
392+
}
393+
}
394+
return nil
395+
}).WithTimeout(5*time.Minute).WithPolling(10*time.Second).Should(Succeed(), "test pod should come back after kubelet restart")
396+
365397
By("fetch Default cpuset from cpu manager state after restart")
366398
cpuManagerCpusetAfterRestart, err := nodes.CpuManagerCpuSet(ctx, workerRTNode)
367399
Expect(err).ToNot(HaveOccurred())

0 commit comments

Comments
 (0)