Fix waiting for PVCs to get Bound

When Get() returns error, the loop should not return with nil. Make sure
that the faulty Get() marks phaseFoundInAllClaims as not satisfied.
This commit is contained in:
Jan Safranek 2020-08-11 10:57:42 +02:00
parent 04362870ad
commit d3503a2881

View File

@ -749,7 +749,8 @@ func WaitForPersistentVolumeClaimsPhase(phase v1.PersistentVolumeClaimPhase, c c
pvc, err := c.CoreV1().PersistentVolumeClaims(ns).Get(context.TODO(), pvcName, metav1.GetOptions{}) pvc, err := c.CoreV1().PersistentVolumeClaims(ns).Get(context.TODO(), pvcName, metav1.GetOptions{})
if err != nil { if err != nil {
framework.Logf("Failed to get claim %q, retrying in %v. Error: %v", pvcName, Poll, err) framework.Logf("Failed to get claim %q, retrying in %v. Error: %v", pvcName, Poll, err)
continue phaseFoundInAllClaims = false
break
} }
if pvc.Status.Phase == phase { if pvc.Status.Phase == phase {
framework.Logf("PersistentVolumeClaim %s found and phase=%s (%v)", pvcName, phase, time.Since(start)) framework.Logf("PersistentVolumeClaim %s found and phase=%s (%v)", pvcName, phase, time.Since(start))