From dbbda5473b75b277246cd9e90d2abf9eea404d4c Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 24 Jun 2022 18:25:20 +0200 Subject: [PATCH] e2e: pass non-empty Namespace/Name in deletePVCAndPV() When getting the PVC or PV failed, the returned object may contain empty values. If that happens, a retry uses the empty values for Namespace and Name, which will never be successful. Instead, use the Namespace and Name attributes from the original object, and not from the object returned by the Get() call. Signed-off-by: Niels de Vos --- e2e/pvc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/pvc.go b/e2e/pvc.go index f87a153cd..41bcb4845 100644 --- a/e2e/pvc.go +++ b/e2e/pvc.go @@ -138,8 +138,8 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v pvcToDelete.Status.String(), int(time.Since(start).Seconds())) pvcToDelete, err = c.CoreV1(). - PersistentVolumeClaims(pvcToDelete.Namespace). - Get(context.TODO(), pvcToDelete.Name, metav1.GetOptions{}) + PersistentVolumeClaims(pvc.Namespace). + Get(context.TODO(), pvc.Name, metav1.GetOptions{}) if err == nil { if pvcToDelete.Status.Phase == "" { // this is unexpected, an empty Phase is not defined @@ -176,7 +176,7 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v pvToDelete.Status.String(), int(time.Since(start).Seconds())) - pvToDelete, err = c.CoreV1().PersistentVolumes().Get(context.TODO(), pvToDelete.Name, metav1.GetOptions{}) + pvToDelete, err = c.CoreV1().PersistentVolumes().Get(context.TODO(), pv.Name, metav1.GetOptions{}) if err == nil { return false, nil }