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/staticpvc.go' and 'e2e/snapshot.go' files to restrict the line length to 120 chars. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
parent
d6a4003981
commit
41ecaadc82
@ -47,7 +47,10 @@ func createSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = sclient.VolumeSnapshots(snap.Namespace).Create(context.TODO(), snap, metav1.CreateOptions{})
|
|
||||||
|
_, err = sclient.
|
||||||
|
VolumeSnapshots(snap.Namespace).
|
||||||
|
Create(context.TODO(), snap, metav1.CreateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create volumesnapshot: %w", err)
|
return fmt.Errorf("failed to create volumesnapshot: %w", err)
|
||||||
}
|
}
|
||||||
@ -60,7 +63,9 @@ func createSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
|
|||||||
|
|
||||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||||
e2elog.Logf("waiting for snapshot %s (%d seconds elapsed)", snap.Name, int(time.Since(start).Seconds()))
|
e2elog.Logf("waiting for snapshot %s (%d seconds elapsed)", snap.Name, int(time.Since(start).Seconds()))
|
||||||
snaps, err := sclient.VolumeSnapshots(snap.Namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
snaps, err := sclient.
|
||||||
|
VolumeSnapshots(snap.Namespace).
|
||||||
|
Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Logf("Error getting snapshot in namespace: '%s': %v", snap.Namespace, err)
|
e2elog.Logf("Error getting snapshot in namespace: '%s': %v", snap.Namespace, err)
|
||||||
if isRetryableAPIError(err) {
|
if isRetryableAPIError(err) {
|
||||||
@ -87,7 +92,10 @@ func deleteSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = sclient.VolumeSnapshots(snap.Namespace).Delete(context.TODO(), snap.Name, metav1.DeleteOptions{})
|
|
||||||
|
err = sclient.
|
||||||
|
VolumeSnapshots(snap.Namespace).
|
||||||
|
Delete(context.TODO(), snap.Name, metav1.DeleteOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to delete volumesnapshot: %w", err)
|
return fmt.Errorf("failed to delete volumesnapshot: %w", err)
|
||||||
}
|
}
|
||||||
@ -99,13 +107,18 @@ func deleteSnapshot(snap *snapapi.VolumeSnapshot, t int) error {
|
|||||||
|
|
||||||
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
return wait.PollImmediate(poll, timeout, func() (bool, error) {
|
||||||
e2elog.Logf("deleting snapshot %s (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
|
e2elog.Logf("deleting snapshot %s (%d seconds elapsed)", name, int(time.Since(start).Seconds()))
|
||||||
_, err := sclient.VolumeSnapshots(snap.Namespace).Get(context.TODO(), name, metav1.GetOptions{})
|
_, err := sclient.
|
||||||
|
VolumeSnapshots(snap.Namespace).
|
||||||
|
Get(context.TODO(), name, metav1.GetOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !apierrs.IsNotFound(err) {
|
if !apierrs.IsNotFound(err) {
|
||||||
return false, fmt.Errorf("get on deleted snapshot %v failed with error other than \"not found\": %v", name, err)
|
return false, fmt.Errorf(
|
||||||
|
"get on deleted snapshot %v failed with error other than \"not found\": %v",
|
||||||
|
name,
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
@ -177,12 +190,17 @@ func getVolumeSnapshotContent(namespace, snapshotName string) (*snapapi.VolumeSn
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
snapshot, err := sclient.VolumeSnapshots(namespace).Get(context.TODO(), snapshotName, metav1.GetOptions{})
|
|
||||||
|
snapshot, err := sclient.
|
||||||
|
VolumeSnapshots(namespace).
|
||||||
|
Get(context.TODO(), snapshotName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get volumesnapshot: %w", err)
|
return nil, fmt.Errorf("failed to get volumesnapshot: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
volumeSnapshotContent, err := sclient.VolumeSnapshotContents().Get(context.TODO(), *snapshot.Status.BoundVolumeSnapshotContentName, metav1.GetOptions{})
|
volumeSnapshotContent, err := sclient.
|
||||||
|
VolumeSnapshotContents().
|
||||||
|
Get(context.TODO(), *snapshot.Status.BoundVolumeSnapshotContentName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get volumesnapshotcontent: %w", err)
|
return nil, fmt.Errorf("failed to get volumesnapshotcontent: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,10 @@ import (
|
|||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getStaticPV(name, volName, size, secretName, secretNS, sc, driverName string, blockPV bool, options map[string]string) *v1.PersistentVolume {
|
func getStaticPV(
|
||||||
|
name, volName, size, secretName, secretNS, sc, driverName string,
|
||||||
|
blockPV bool,
|
||||||
|
options map[string]string) *v1.PersistentVolume {
|
||||||
pv := &v1.PersistentVolume{
|
pv := &v1.PersistentVolume{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
@ -102,7 +105,11 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock, checkI
|
|||||||
fsID = strings.Trim(fsID, "\n")
|
fsID = strings.Trim(fsID, "\n")
|
||||||
size := "4Gi"
|
size := "4Gi"
|
||||||
// create rbd image
|
// create rbd image
|
||||||
cmd := fmt.Sprintf("rbd create %s --size=%d --image-feature=layering %s", rbdImageName, 4096, rbdOptions(defaultRBDPool))
|
cmd := fmt.Sprintf(
|
||||||
|
"rbd create %s --size=%d --image-feature=layering %s",
|
||||||
|
rbdImageName,
|
||||||
|
4096,
|
||||||
|
rbdOptions(defaultRBDPool))
|
||||||
|
|
||||||
_, e, err = execCommandInToolBoxPod(f, cmd, rookNamespace)
|
_, e, err = execCommandInToolBoxPod(f, cmd, rookNamespace)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -121,7 +128,16 @@ func validateRBDStaticPV(f *framework.Framework, appPath string, isBlock, checkI
|
|||||||
opt["radosNamespace"] = radosNamespace
|
opt["radosNamespace"] = radosNamespace
|
||||||
}
|
}
|
||||||
|
|
||||||
pv := getStaticPV(pvName, rbdImageName, size, rbdNodePluginSecretName, cephCSINamespace, sc, "rbd.csi.ceph.com", isBlock, opt)
|
pv := getStaticPV(
|
||||||
|
pvName,
|
||||||
|
rbdImageName,
|
||||||
|
size,
|
||||||
|
rbdNodePluginSecretName,
|
||||||
|
cephCSINamespace,
|
||||||
|
sc,
|
||||||
|
"rbd.csi.ceph.com",
|
||||||
|
isBlock,
|
||||||
|
opt)
|
||||||
|
|
||||||
_, err = c.CoreV1().PersistentVolumes().Create(context.TODO(), pv, metav1.CreateOptions{})
|
_, err = c.CoreV1().PersistentVolumes().Create(context.TODO(), pv, metav1.CreateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user