e2e rc: if the pods are running but not ready the test will fail

Change-Id: Ic9211f8117caa7c320e2fb0f8d668184450c1d90
This commit is contained in:
Antonio Ojea 2023-05-25 07:19:51 +00:00
parent a6003ae1e1
commit a50549cc90

View File

@ -501,7 +501,7 @@ func TestReplicationControllerServeImageOrFail(ctx context.Context, f *framework
pods, err := e2epod.PodsCreated(ctx, f.ClientSet, f.Namespace.Name, name, replicas) pods, err := e2epod.PodsCreated(ctx, f.ClientSet, f.Namespace.Name, name, replicas)
framework.ExpectNoError(err) framework.ExpectNoError(err)
// Wait for the pods to enter the running state. Waiting loops until the pods // Wait for the pods to enter the running state and are Ready. Waiting loops until the pods
// are running so non-running pods cause a timeout for this test. // are running so non-running pods cause a timeout for this test.
framework.Logf("Ensuring all pods for ReplicationController %q are running", name) framework.Logf("Ensuring all pods for ReplicationController %q are running", name)
running := int32(0) running := int32(0)
@ -509,7 +509,7 @@ func TestReplicationControllerServeImageOrFail(ctx context.Context, f *framework
if pod.DeletionTimestamp != nil { if pod.DeletionTimestamp != nil {
continue continue
} }
err = e2epod.WaitForPodNameRunningInNamespace(ctx, f.ClientSet, pod.Name, f.Namespace.Name) err = e2epod.WaitTimeoutForPodReadyInNamespace(ctx, f.ClientSet, pod.Name, f.Namespace.Name, framework.PodStartTimeout)
if err != nil { if err != nil {
updatePod, getErr := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{}) updatePod, getErr := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{})
if getErr == nil { if getErr == nil {
@ -519,12 +519,12 @@ func TestReplicationControllerServeImageOrFail(ctx context.Context, f *framework
} }
} }
framework.ExpectNoError(err) framework.ExpectNoError(err)
framework.Logf("Pod %q is running (conditions: %+v)", pod.Name, pod.Status.Conditions) framework.Logf("Pod %q is running and ready(conditions: %+v)", pod.Name, pod.Status.Conditions)
running++ running++
} }
// Sanity check // Sanity check
framework.ExpectEqual(running, replicas, "unexpected number of running pods: %+v", pods.Items) framework.ExpectEqual(running, replicas, "unexpected number of running and ready pods: %+v", pods.Items)
// Verify that something is listening. // Verify that something is listening.
framework.Logf("Trying to dial the pod") framework.Logf("Trying to dial the pod")