e2e_node: verify restart looping container correctly

when a test is verifying a container has restarted, we use a continually exiting
container. Not verifying the number of restarts is less than (rather than equal) introduces
a race between the container restarting and the status observation.

Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
Peter Hunt
2025-06-04 13:27:46 -04:00
parent 849a82b727
commit daae472fe1

View File

@@ -328,7 +328,7 @@ func verifyPodRestartCount(ctx context.Context, f *framework.Framework, podName
updatedPod.Name, expectedNumContainers, len(updatedPod.Status.ContainerStatuses))
}
for _, containerStatus := range updatedPod.Status.ContainerStatuses {
if containerStatus.RestartCount != expectedRestartCount {
if containerStatus.RestartCount < expectedRestartCount {
return fmt.Errorf("pod %s had container with restartcount %d. Should have been at least %d",
updatedPod.Name, containerStatus.RestartCount, expectedRestartCount)
}