From 155db11b735cf6cfaa3847c984eee96231a070e8 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Mon, 18 May 2020 15:46:41 -0400 Subject: [PATCH] Do not fail test if pod is not found --- test/e2e/framework/pod/delete.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/e2e/framework/pod/delete.go b/test/e2e/framework/pod/delete.go index 2da92d4d8e0..e779dc80a1d 100644 --- a/test/e2e/framework/pod/delete.go +++ b/test/e2e/framework/pod/delete.go @@ -35,10 +35,15 @@ const ( PodDeleteTimeout = 5 * time.Minute ) -// DeletePodOrFail deletes the pod of the specified namespace and name. +// DeletePodOrFail deletes the pod of the specified namespace and name. Resilient to the pod +// not existing. func DeletePodOrFail(c clientset.Interface, ns, name string) { ginkgo.By(fmt.Sprintf("Deleting pod %s in namespace %s", name, ns)) err := c.CoreV1().Pods(ns).Delete(context.TODO(), name, metav1.DeleteOptions{}) + if err != nil && apierrors.IsNotFound(err) { + return + } + expectNoError(err, "failed to delete pod %s in namespace %s", name, ns) }