Skip to content

Commit 6ddc9e1

Browse files
author
Ariel Kass
committed
resolve wsl_v5 linter issues
Signed-off-by: Ariel Kass <[email protected]>
1 parent 3ac45e6 commit 6ddc9e1

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

controllers/replication/replication_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ func TestGetMessageFromError(t *testing.T) {
5151
newtt := tt
5252
t.Run(newtt.name, func(t *testing.T) {
5353
t.Parallel()
54-
if got := GetMessageFromError(newtt.err); got != newtt.want {
54+
55+
got := GetMessageFromError(newtt.err)
56+
if got != newtt.want {
5557
t.Errorf("GetMessageFromError() = %v, want %v", got, newtt.want)
5658
}
5759
})

controllers/volumereplication_controller.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
129129
// get secret
130130
secretName := vrcObj.Spec.Parameters[prefixedReplicationSecretNameKey]
131131
secretNamespace := vrcObj.Spec.Parameters[prefixedReplicationSecretNamespaceKey]
132+
132133
secret := make(map[string]string)
133134
if secretName != "" && secretNamespace != "" {
134135
secret, err = r.getSecret(ctx, logger, secretName, secretNamespace)
135136
if err != nil {
136137
setFailureCondition(instance)
138+
137139
uErr := r.updateReplicationStatus(ctx, instance, logger, getCurrentReplicationState(instance), err.Error())
138140
if uErr != nil {
139141
logger.Error(uErr, "failed to update volumeReplication status", "VRName", instance.Name)
@@ -162,6 +164,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
162164
if pvErr != nil {
163165
logger.Error(pvErr, "failed to get PVC", "PVCName", instance.Spec.DataSource.Name)
164166
setFailureCondition(instance)
167+
165168
uErr := r.updateReplicationStatus(ctx, instance, logger, getCurrentReplicationState(instance), pvErr.Error())
166169
if uErr != nil {
167170
logger.Error(uErr, "failed to update volumeReplication status", "VRName", instance.Name)
@@ -247,6 +250,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
247250
return reconcile.Result{}, err
248251
}
249252
}
253+
250254
if vg != nil {
251255
err = r.removeFinalizerFromVG(ctx, logger, vg)
252256
if err != nil {
@@ -294,8 +298,10 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
294298
}
295299

296300
var replicationErr error
301+
297302
var requeueForResync bool
298303

304+
299305
switch instance.Spec.ReplicationState {
300306
case replicationv1alpha1.Primary:
301307
replicationErr = r.markVolumeAsPrimary(instance, logger, replicationSource, replicationHandle, parameters, secret)
@@ -408,6 +414,7 @@ func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager, cfg *co
408414

409415
return err
410416
}
417+
411418
r.Scheme.AddKnownTypes(volumegroupv1.GroupVersion,
412419
&volumegroupv1.VolumeGroup{},
413420
&volumegroupv1.VolumeGroupContent{},
@@ -425,12 +432,14 @@ func (r *VolumeReplicationReconciler) SetupWithManager(mgr ctrl.Manager, cfg *co
425432

426433
return err
427434
}
435+
428436
err = gClient.Probe()
429437
if err != nil {
430438
r.Log.Error(err, "failed to connect to driver", "Endpoint", cfg.DriverEndpoint, "GRPC Timeout", cfg.RPCTimeout)
431439

432440
return err
433441
}
442+
434443
r.GRPCClient = gClient
435444
r.Replication = grpcClient.NewReplicationClient(r.GRPCClient.Client, cfg.RPCTimeout)
436445

@@ -498,6 +507,7 @@ func (r *VolumeReplicationReconciler) waitForVolumeReplicationResource(logger lo
498507

499508
return err
500509
}
510+
501511
logger.Info("resource does not exist", "Resource", resourceName)
502512
time.Sleep(5 * time.Second)
503513
}
@@ -532,6 +542,7 @@ func (r *VolumeReplicationReconciler) markVolumeAsPrimary(volumeReplicationObjec
532542
} else {
533543
// force promotion
534544
logger.Info("force promoting volume due to known grpc error", "error", resp.Error)
545+
535546
volumeReplication.Force = true
536547
resp := volumeReplication.Promote()
537548
if resp.Error != nil {

controllers/volumereplicationclass_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func TestGetVolumeReplicaClass(t *testing.T) {
6666

6767
if tc.errorExpected {
6868
require.Error(t, err)
69+
6970
if tc.isErrorNotFound {
7071
require.True(t, errors.IsNotFound(err))
7172
}

0 commit comments

Comments
 (0)