diff --git a/e2e/resize.go b/e2e/resize.go index c3dad4501..06c4dfe97 100644 --- a/e2e/resize.go +++ b/e2e/resize.go @@ -92,6 +92,10 @@ func resizePVCAndValidateSize(pvcPath, appPath string, f *framework.Framework) e LabelSelector: "app=resize-pvc", } + pvc, err = f.ClientSet.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{}) + if err != nil { + return err + } if *pvc.Spec.VolumeMode == v1.PersistentVolumeFilesystem { err = checkDirSize(app, f, &opt, size) if err != nil { @@ -140,8 +144,8 @@ func checkDirSize(app *v1.Pod, f *framework.Framework, opt *metav1.ListOptions, func checkDeviceSize(app *v1.Pod, f *framework.Framework, opt *metav1.ListOptions, size string) error { cmd := getDeviceSizeCheckCmd(app.Spec.Containers[0].VolumeDevices[0].DevicePath) return checkAppMntSize(f, opt, size, cmd, app.Namespace, deployTimeout) - } + func getDirSizeCheckCmd(dirPath string) string { return fmt.Sprintf("df -h|grep %s |awk '{print $2}'", dirPath) } diff --git a/e2e/utils.go b/e2e/utils.go index 28801e4ff..ca3e3981c 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -120,10 +120,8 @@ func waitForDeploymentComplete(name, ns string, c clientset.Interface, t int) er if deployment.Status.Replicas == deployment.Status.ReadyReplicas { return true, nil } - + e2elog.Logf("deployment status: expected replica count %d running replica count %d", deployment.Status.Replicas, deployment.Status.ReadyReplicas) reason = fmt.Sprintf("deployment status: %#v", deployment.Status.String()) - e2elog.Logf(reason) - return false, nil }) @@ -383,9 +381,11 @@ func createPVCAndvalidatePV(c kubernetes.Interface, pvc *v1.PersistentVolumeClai } return false, err } + if pvc.Spec.VolumeName == "" { return false, nil } + pv, err = c.CoreV1().PersistentVolumes().Get(pvc.Spec.VolumeName, metav1.GetOptions{}) if err != nil { return false, err @@ -479,7 +479,7 @@ func waitForPodInRunningState(name, ns string, c kubernetes.Interface, t int) er case v1.PodFailed, v1.PodSucceeded: return false, conditions.ErrPodCompleted } - e2elog.Logf("%s app is in %s phase expected to be in Running state (%d seconds elapsed)", name, pod.Status.Phase, int(time.Since(start).Seconds())) + e2elog.Logf("%s app is in %s phase expected to be in Running state (%d seconds elapsed)", name, pod.Status.Phase, int(time.Since(start).Seconds())) return false, nil }) }