Improve logging while waiting for deployment to complete

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2019-12-18 17:16:17 +05:30 committed by mergify[bot]
parent ad7e5ca301
commit f69ec085cc
2 changed files with 9 additions and 5 deletions

View File

@ -92,6 +92,10 @@ func resizePVCAndValidateSize(pvcPath, appPath string, f *framework.Framework) e
LabelSelector: "app=resize-pvc", 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 { if *pvc.Spec.VolumeMode == v1.PersistentVolumeFilesystem {
err = checkDirSize(app, f, &opt, size) err = checkDirSize(app, f, &opt, size)
if err != nil { 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 { func checkDeviceSize(app *v1.Pod, f *framework.Framework, opt *metav1.ListOptions, size string) error {
cmd := getDeviceSizeCheckCmd(app.Spec.Containers[0].VolumeDevices[0].DevicePath) cmd := getDeviceSizeCheckCmd(app.Spec.Containers[0].VolumeDevices[0].DevicePath)
return checkAppMntSize(f, opt, size, cmd, app.Namespace, deployTimeout) return checkAppMntSize(f, opt, size, cmd, app.Namespace, deployTimeout)
} }
func getDirSizeCheckCmd(dirPath string) string { func getDirSizeCheckCmd(dirPath string) string {
return fmt.Sprintf("df -h|grep %s |awk '{print $2}'", dirPath) return fmt.Sprintf("df -h|grep %s |awk '{print $2}'", dirPath)
} }

View File

@ -120,10 +120,8 @@ func waitForDeploymentComplete(name, ns string, c clientset.Interface, t int) er
if deployment.Status.Replicas == deployment.Status.ReadyReplicas { if deployment.Status.Replicas == deployment.Status.ReadyReplicas {
return true, nil 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()) reason = fmt.Sprintf("deployment status: %#v", deployment.Status.String())
e2elog.Logf(reason)
return false, nil return false, nil
}) })
@ -383,9 +381,11 @@ func createPVCAndvalidatePV(c kubernetes.Interface, pvc *v1.PersistentVolumeClai
} }
return false, err return false, err
} }
if pvc.Spec.VolumeName == "" { if pvc.Spec.VolumeName == "" {
return false, nil return false, nil
} }
pv, err = c.CoreV1().PersistentVolumes().Get(pvc.Spec.VolumeName, metav1.GetOptions{}) pv, err = c.CoreV1().PersistentVolumes().Get(pvc.Spec.VolumeName, metav1.GetOptions{})
if err != nil { if err != nil {
return false, err return false, err