Skip to content

Commit

Permalink
Enable confusing-naming revive flag
Browse files Browse the repository at this point in the history
Signed-off-by: Elena Gershkovich <[email protected]>
  • Loading branch information
ELENAGER committed Jan 22, 2024
1 parent 1224ed8 commit 26cc165
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ linters-settings:
# - name: flag-parameter
- name: unused-receiver
- name: unused-parameter
# - name: confusing-naming
- name: confusing-naming
- name: import-shadowing
- name: confusing-results
- name: bool-literal-in-expr
Expand Down
11 changes: 0 additions & 11 deletions controllers/drpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
}

secretsUtil := &util.SecretsUtil{Client: r.Client, APIReader: r.APIReader, Ctx: ctx, Log: log}
// DRPolicy is marked for deletion
if !drpolicy.ObjectMeta.DeletionTimestamp.IsZero() &&
controllerutil.ContainsFinalizer(drpolicy, drPolicyFinalizerName) {
return ctrl.Result{}, u.deleteDRPolicy(drclusters, secretsUtil, ramenConfig)
Expand All @@ -111,7 +110,6 @@ func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c

log.Error(err, "Missing dependent resources")

// will be reconciled later based on DRCluster watch events
return ctrl.Result{}, nil
}

Expand All @@ -127,15 +125,6 @@ func (r *DRPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
return ctrl.Result{}, fmt.Errorf("error in intiating policy metrics: %w", err)
}

return r.reconcile(drpolicy, drclusters, secretsUtil, ramenConfig, log)
}

func (*DRPolicyReconciler) reconcile(drpolicy *ramen.DRPolicy,
drclusters *ramen.DRClusterList,
secretsUtil *util.SecretsUtil,
ramenConfig *ramen.RamenConfig,
log logr.Logger,
) (ctrl.Result, error) {
if err := propagateS3Secret(drpolicy, drclusters, secretsUtil, ramenConfig, log); err != nil {
return ctrl.Result{}, fmt.Errorf("drpolicy deploy: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions controllers/volsync/vshandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (v *VSHandler) createOrUpdateRD(
) {
l := v.log.WithValues("rdSpec", rdSpec)

volumeSnapshotClassName, err := v.GetVolumeSnapshotClassFromPVCStorageClass(rdSpec.ProtectedPVC.StorageClassName)
volumeSnapshotClassName, err := v.GetVolumeSnapshotClassFromPVCStorageClassName(rdSpec.ProtectedPVC.StorageClassName)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1350,7 +1350,7 @@ func (v *VSHandler) ModifyRSSpecForCephFS(rsSpec *ramendrv1alpha1.VolSyncReplica
return nil
}

func (v *VSHandler) GetVolumeSnapshotClassFromPVCStorageClass(storageClassName *string) (string, error) {
func (v *VSHandler) GetVolumeSnapshotClassFromPVCStorageClassName(storageClassName *string) (string, error) {
storageClass, err := v.getStorageClass(storageClassName)
if err != nil {
return "", err
Expand Down
12 changes: 6 additions & 6 deletions controllers/volsync/vshandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ var _ = Describe("VolSync Handler - Volume Replication Class tests", func() {
Expect(len(vsClasses)).To(Equal(totalVolumeSnapshotClassCount))
})

It("GetVolumeSnapshotClassFromPVCStorageClass() should find the default volume snapshot class "+
It("GetVolumeSnapshotClassFromPVCStorageClassName() should find the default volume snapshot class "+
"that matches the driver from the storageclass", func() {
vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClass(&testStorageClassName)
vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClassName(&testStorageClassName)
Expect(err).NotTo(HaveOccurred())

Expect(vsClassName).To(Equal(testDefaultVolumeSnapshotClass.GetName()))
Expand Down Expand Up @@ -138,9 +138,9 @@ var _ = Describe("VolSync Handler - Volume Replication Class tests", func() {
Expect(vscBFound).To(BeTrue())
})

It("GetVolumeSnapshotClassFromPVCStorageClass() should not find a match if no volume snapshot "+
It("GetVolumeSnapshotClassFromPVCStorageClassName() should not find a match if no volume snapshot "+
"classes matche the driver from the storageclass", func() {
vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClass(&testStorageClassName)
vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClassName(&testStorageClassName)
Expect(err).To(HaveOccurred())
Expect(vsClassName).To(Equal(""))
Expect(err.Error()).To(ContainSubstring("unable to find matching volumesnapshotclass"))
Expand Down Expand Up @@ -169,10 +169,10 @@ var _ = Describe("VolSync Handler - Volume Replication Class tests", func() {
Expect(vsClasses[0].GetName()).To(Equal(volumeSnapshotClassB.GetName()))
})

It("GetVolumeSnapshotClassFromPVCStorageClass() should not find a match if no volume snapshot "+
It("GetVolumeSnapshotClassFromPVCStorageClassName() should not find a match if no volume snapshot "+
"classes matche the driver from the storageclass", func() {
storageClassName := storageClassAandB.GetName()
vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClass(&storageClassName)
vsClassName, err := vsHandler.GetVolumeSnapshotClassFromPVCStorageClassName(&storageClassName)
Expect(err).NotTo(HaveOccurred())
Expect(vsClassName).To(Equal(volumeSnapshotClassB.GetName()))
})
Expand Down
4 changes: 2 additions & 2 deletions controllers/vrg_volrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (v *VRGInstance) reconcileVolRepsAsPrimary() {
// itself is assumed to be protected along with other k8s objects in the
// subscription, such as, the deployment, pods, services, etc., by an
// entity external to the VRG a la IaC.
if err := v.uploadPVandPVCtoS3Stores(pvc, log); err != nil {
if err := v.uploadPVandPVCtoS3Profiles(pvc, log); err != nil {
log.Info("Requeuing due to failure to upload PV object to S3 store(s)",
"errorValue", err)

Expand Down Expand Up @@ -553,7 +553,7 @@ func (v *VRGInstance) isArchivedAlready(pvc *corev1.PersistentVolumeClaim, log l
}

// Upload PV to the list of S3 stores in the VRG spec
func (v *VRGInstance) uploadPVandPVCtoS3Stores(pvc *corev1.PersistentVolumeClaim, log logr.Logger) (err error) {
func (v *VRGInstance) uploadPVandPVCtoS3Profiles(pvc *corev1.PersistentVolumeClaim, log logr.Logger) (err error) {
if v.isArchivedAlready(pvc, log) {
v.log.Info("PV cluster data already protected for PVC", "PVC", pvc.Name)

Expand Down

0 comments on commit 26cc165

Please sign in to comment.