From 7aa53350ffebba479c01c005a07d053002a0b612 Mon Sep 17 00:00:00 2001 From: Humble Chirammal Date: Fri, 25 Jun 2021 18:25:46 +0530 Subject: [PATCH] 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/resize.go' files to restrict the line length to 120 chars. Signed-off-by: Humble Chirammal --- e2e/resize.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/e2e/resize.go b/e2e/resize.go index 081706e22..ca002e40a 100644 --- a/e2e/resize.go +++ b/e2e/resize.go @@ -20,21 +20,27 @@ import ( func expandPVCSize(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, size string, t int) error { pvcName := pvc.Name - updatedPVC, err := c.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(context.TODO(), pvcName, metav1.GetOptions{}) + updatedPVC, err := c.CoreV1(). + PersistentVolumeClaims(pvc.Namespace). + Get(context.TODO(), pvcName, metav1.GetOptions{}) if err != nil { return fmt.Errorf("error fetching pvc %q with %w", pvcName, err) } timeout := time.Duration(t) * time.Minute updatedPVC.Spec.Resources.Requests[v1.ResourceStorage] = resource.MustParse(size) - _, err = c.CoreV1().PersistentVolumeClaims(updatedPVC.Namespace).Update(context.TODO(), updatedPVC, metav1.UpdateOptions{}) + _, err = c.CoreV1(). + PersistentVolumeClaims(updatedPVC.Namespace). + Update(context.TODO(), updatedPVC, metav1.UpdateOptions{}) Expect(err).Should(BeNil()) start := time.Now() e2elog.Logf("Waiting up to %v to be in Resized state", pvc) return wait.PollImmediate(poll, timeout, func() (bool, error) { e2elog.Logf("waiting for PVC %s (%d seconds elapsed)", updatedPVC.Name, int(time.Since(start).Seconds())) - updatedPVC, err = c.CoreV1().PersistentVolumeClaims(updatedPVC.Namespace).Get(context.TODO(), pvcName, metav1.GetOptions{}) + updatedPVC, err = c.CoreV1(). + PersistentVolumeClaims(updatedPVC.Namespace). + Get(context.TODO(), pvcName, metav1.GetOptions{}) if err != nil { e2elog.Logf("Error getting pvc in namespace: '%s': %v", updatedPVC.Namespace, err) if isRetryableAPIError(err) { @@ -45,13 +51,17 @@ func expandPVCSize(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, size s pvcConditions := updatedPVC.Status.Conditions if len(pvcConditions) > 0 { e2elog.Logf("pvc state %v", pvcConditions[0].Type) - if pvcConditions[0].Type == v1.PersistentVolumeClaimResizing || pvcConditions[0].Type == v1.PersistentVolumeClaimFileSystemResizePending { + if pvcConditions[0].Type == v1.PersistentVolumeClaimResizing || + pvcConditions[0].Type == v1.PersistentVolumeClaimFileSystemResizePending { return false, nil } } if !updatedPVC.Status.Capacity[v1.ResourceStorage].Equal(resource.MustParse(size)) { - e2elog.Logf("current size in status %v,expected size %v", updatedPVC.Status.Capacity[v1.ResourceStorage], resource.MustParse(size)) + e2elog.Logf( + "current size in status %v,expected size %v", + updatedPVC.Status.Capacity[v1.ResourceStorage], + resource.MustParse(size)) return false, nil } return true, nil @@ -90,7 +100,9 @@ func resizePVCAndValidateSize(pvcPath, appPath string, f *framework.Framework) e LabelSelector: "app=resize-pvc", } - pvc, err = f.ClientSet.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(context.TODO(), pvc.Name, metav1.GetOptions{}) + pvc, err = f.ClientSet.CoreV1(). + PersistentVolumeClaims(pvc.Namespace). + Get(context.TODO(), pvc.Name, metav1.GetOptions{}) if err != nil { return fmt.Errorf("failed to get pvc: %w", err) }