Merge pull request #91221 from gnufied/tolerate-pod-not-found

Tolerate pod not found errors in storage e2e
This commit is contained in:
Kubernetes Prow Robot 2020-05-19 16:32:33 -07:00 committed by GitHub
commit 739a61a871
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,10 +35,15 @@ const (
PodDeleteTimeout = 5 * time.Minute 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) { func DeletePodOrFail(c clientset.Interface, ns, name string) {
ginkgo.By(fmt.Sprintf("Deleting pod %s in namespace %s", name, ns)) ginkgo.By(fmt.Sprintf("Deleting pod %s in namespace %s", name, ns))
err := c.CoreV1().Pods(ns).Delete(context.TODO(), name, metav1.DeleteOptions{}) 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) expectNoError(err, "failed to delete pod %s in namespace %s", name, ns)
} }