mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
e2e: reformat long lines in this package to 120 chars
We have many declarations and invocations..etc with long lines which are very difficult to follow while doing code reading. This address the issues in 'e2e/pvc.go' file to restrict the line length to 120 chars. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
676b9f84c3
commit
1849887b40
35
e2e/pvc.go
35
e2e/pvc.go
@ -102,8 +102,14 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
|
|||||||
pvcToDelete := pvc
|
pvcToDelete := pvc
|
||||||
err = wait.PollImmediate(poll, timeout, func() (bool, error) {
|
err = wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||||
// Check that the PVC is deleted.
|
// Check that the PVC is deleted.
|
||||||
e2elog.Logf("waiting for PVC %s in state %s to be deleted (%d seconds elapsed)", pvcToDelete.Name, pvcToDelete.Status.String(), int(time.Since(start).Seconds()))
|
e2elog.Logf(
|
||||||
pvcToDelete, err = c.CoreV1().PersistentVolumeClaims(pvcToDelete.Namespace).Get(context.TODO(), pvcToDelete.Name, metav1.GetOptions{})
|
"waiting for PVC %s in state %s to be deleted (%d seconds elapsed)",
|
||||||
|
pvcToDelete.Name,
|
||||||
|
pvcToDelete.Status.String(),
|
||||||
|
int(time.Since(start).Seconds()))
|
||||||
|
pvcToDelete, err = c.CoreV1().
|
||||||
|
PersistentVolumeClaims(pvcToDelete.Namespace).
|
||||||
|
Get(context.TODO(), pvcToDelete.Name, metav1.GetOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if pvcToDelete.Status.Phase == "" {
|
if pvcToDelete.Status.Phase == "" {
|
||||||
// this is unexpected, an empty Phase is not defined
|
// this is unexpected, an empty Phase is not defined
|
||||||
@ -113,7 +119,10 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
if !apierrs.IsNotFound(err) {
|
if !apierrs.IsNotFound(err) {
|
||||||
return false, fmt.Errorf("get on deleted PVC %v failed with error other than \"not found\": %w", pvc.Name, err)
|
return false, fmt.Errorf(
|
||||||
|
"get on deleted PVC %v failed with error other than \"not found\": %w",
|
||||||
|
pvc.Name,
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
@ -126,7 +135,11 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
|
|||||||
pvToDelete := pv
|
pvToDelete := pv
|
||||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||||
// Check that the PV is deleted.
|
// Check that the PV is deleted.
|
||||||
e2elog.Logf("waiting for PV %s in state %s to be deleted (%d seconds elapsed)", pvToDelete.Name, pvToDelete.Status.String(), int(time.Since(start).Seconds()))
|
e2elog.Logf(
|
||||||
|
"waiting for PV %s in state %s to be deleted (%d seconds elapsed)",
|
||||||
|
pvToDelete.Name,
|
||||||
|
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(), pvToDelete.Name, metav1.GetOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -141,7 +154,9 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPVCAndPV(c kubernetes.Interface, pvcName, pvcNamespace string) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
|
func getPVCAndPV(
|
||||||
|
c kubernetes.Interface,
|
||||||
|
pvcName, pvcNamespace string) (*v1.PersistentVolumeClaim, *v1.PersistentVolume, error) {
|
||||||
pvc, err := c.CoreV1().PersistentVolumeClaims(pvcNamespace).Get(context.TODO(), pvcName, metav1.GetOptions{})
|
pvc, err := c.CoreV1().PersistentVolumeClaims(pvcNamespace).Get(context.TODO(), pvcName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to get PVC with error %v", err)
|
return nil, nil, fmt.Errorf("failed to get PVC with error %v", err)
|
||||||
@ -176,7 +191,11 @@ func deletePVCAndValidatePV(c kubernetes.Interface, pvc *v1.PersistentVolumeClai
|
|||||||
start := time.Now()
|
start := time.Now()
|
||||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||||
// Check that the PVC is really deleted.
|
// Check that the PVC is really deleted.
|
||||||
e2elog.Logf("waiting for PVC %s in state %s to be deleted (%d seconds elapsed)", name, pvc.Status.String(), int(time.Since(start).Seconds()))
|
e2elog.Logf(
|
||||||
|
"waiting for PVC %s in state %s to be deleted (%d seconds elapsed)",
|
||||||
|
name,
|
||||||
|
pvc.Status.String(),
|
||||||
|
int(time.Since(start).Seconds()))
|
||||||
pvc, err = c.CoreV1().PersistentVolumeClaims(nameSpace).Get(context.TODO(), name, metav1.GetOptions{})
|
pvc, err = c.CoreV1().PersistentVolumeClaims(nameSpace).Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
@ -202,7 +221,9 @@ func deletePVCAndValidatePV(c kubernetes.Interface, pvc *v1.PersistentVolumeClai
|
|||||||
// getBoundPV returns a PV details.
|
// getBoundPV returns a PV details.
|
||||||
func getBoundPV(client kubernetes.Interface, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolume, error) {
|
func getBoundPV(client kubernetes.Interface, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolume, error) {
|
||||||
// Get new copy of the claim
|
// Get new copy of the claim
|
||||||
claim, err := client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(context.TODO(), pvc.Name, metav1.GetOptions{})
|
claim, err := client.CoreV1().
|
||||||
|
PersistentVolumeClaims(pvc.Namespace).
|
||||||
|
Get(context.TODO(), pvc.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get pvc: %w", err)
|
return nil, fmt.Errorf("failed to get pvc: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user