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",
}
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)
}

View File

@ -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
})
}