Skip to content

Commit

Permalink
Fix code style guidelines. Fix test failure.
Browse files Browse the repository at this point in the history
Signed-off-by: MICHAEL S FRUCHTMAN <[email protected]>
  • Loading branch information
msfrucht committed Jun 26, 2024
1 parent 6b48be7 commit 8dc4121
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/controller/data_upload_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ func initDataUploaderReconcilerWithError(needError ...error) (*DataUploadReconci
}
}

fakeSnapshotClient := snapshotFake.NewSimpleClientset(vsObject, vscObj, storageClassObject)
fakeKubeClient := clientgofake.NewSimpleClientset(daemonSet)
fakeSnapshotClient := snapshotFake.NewSimpleClientset(vsObject, vscObj)
fakeKubeClient := clientgofake.NewSimpleClientset(daemonSet, storageClassObject)
fakeFS := velerotest.NewFakeFileSystem()
pathGlob := fmt.Sprintf("/host_pods/%s/volumes/*/%s", "", dataUploadName)
_, err = fakeFS.Create(pathGlob)
Expand Down
4 changes: 2 additions & 2 deletions pkg/exposer/csi_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,13 @@ func (e *csiSnapshotExposer) createBackupPVC(ctx context.Context, ownerObject co
}

// transform the PVC if the storage class provisioner supports shallow copy restore to avoid copy on restore for some storage provisioners
updated_pvc, err := shallowprovisioner.ShallowCopyTransform(ctx, e.kubeClient.StorageV1(), pvc)
updatedPVC, err := shallowprovisioner.ShallowCopyTransform(ctx, e.kubeClient.StorageV1(), pvc)
if err != nil {
// failed to retrieve the storageClass of the PVC
return nil, err
}

created, err := e.kubeClient.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(ctx, updated_pvc, metav1.CreateOptions{})
created, err := e.kubeClient.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(ctx, updatedPVC, metav1.CreateOptions{})
if err != nil {
return nil, errors.Wrap(err, "error to create pvc")
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/exposer/shallowprovisioner/shallow_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ func (p cephFSProvisioner) Evaluate(storageClass *storagev1api.StorageClass) boo

// cephfs only requires that the accessmode is set to readwriteonly
func (p cephFSProvisioner) Transform(pvc *corev1api.PersistentVolumeClaim) *corev1api.PersistentVolumeClaim {
transform_pvc := pvc.DeepCopy()
transformPVC := pvc.DeepCopy()

transform_pvc.Spec.AccessModes = []corev1api.PersistentVolumeAccessMode{corev1api.ReadOnlyMany}
transformPVC.Spec.AccessModes = []corev1api.PersistentVolumeAccessMode{corev1api.ReadOnlyMany}

return transform_pvc
return transformPVC
}

/*
Expand All @@ -158,9 +158,9 @@ func (p scaleProvisioner) Evaluate(storageClass *storagev1api.StorageClass) bool

// scale only requires that the accessmode is set to readwriteonly
func (p scaleProvisioner) Transform(pvc *corev1api.PersistentVolumeClaim) *corev1api.PersistentVolumeClaim {
transform_pvc := pvc.DeepCopy()
transformPVC := pvc.DeepCopy()

transform_pvc.Spec.AccessModes = []corev1api.PersistentVolumeAccessMode{corev1api.ReadOnlyMany}
transformPVC.Spec.AccessModes = []corev1api.PersistentVolumeAccessMode{corev1api.ReadOnlyMany}

return transform_pvc
return transformPVC
}

0 comments on commit 8dc4121

Please sign in to comment.