diff --git a/test/e2e/framework/pod/pod_client.go b/test/e2e/framework/pod/pod_client.go index 6c688c8449b..3494ef5a8c5 100644 --- a/test/e2e/framework/pod/pod_client.go +++ b/test/e2e/framework/pod/pod_client.go @@ -308,8 +308,13 @@ func (c *PodClient) WaitForFinish(ctx context.Context, name string, timeout time // WaitForErrorEventOrSuccess waits for pod to succeed or an error event for that pod. func (c *PodClient) WaitForErrorEventOrSuccess(ctx context.Context, pod *v1.Pod) (*v1.Event, error) { + return c.WaitForErrorEventOrSuccessWithTimeout(ctx, pod, framework.PodStartTimeout) +} + +// WaitForErrorEventOrSuccessWithTimeout waits for pod to succeed or an error event for that pod for a specified time +func (c *PodClient) WaitForErrorEventOrSuccessWithTimeout(ctx context.Context, pod *v1.Pod, timeout time.Duration) (*v1.Event, error) { var ev *v1.Event - err := wait.PollUntilContextTimeout(ctx, framework.Poll, framework.PodStartTimeout, false, func(ctx context.Context) (bool, error) { + err := wait.PollUntilContextTimeout(ctx, framework.Poll, timeout, false, func(ctx context.Context) (bool, error) { evnts, err := c.f.ClientSet.CoreV1().Events(pod.Namespace).Search(scheme.Scheme, pod) if err != nil { return false, fmt.Errorf("error in listing events: %w", err) diff --git a/test/e2e/node/gpu.go b/test/e2e/node/gpu.go index e53787d9132..09f82804339 100644 --- a/test/e2e/node/gpu.go +++ b/test/e2e/node/gpu.go @@ -154,7 +154,7 @@ func createAndValidatePod(ctx context.Context, f *framework.Framework, podClient pod = podClient.Create(ctx, pod) ginkgo.By("Watching for error events or started pod") - ev, err := podClient.WaitForErrorEventOrSuccess(ctx, pod) + ev, err := podClient.WaitForErrorEventOrSuccessWithTimeout(ctx, pod, framework.PodStartTimeout*3) framework.ExpectNoError(err) gomega.Expect(ev).To(gomega.BeNil())