Skip to content

Commit

Permalink
Lint fixes:
Browse files Browse the repository at this point in the history
  - do not nil as context
  - unused function
  • Loading branch information
babysnakes committed Feb 17, 2024
1 parent 376ef1e commit 4905918
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
10 changes: 0 additions & 10 deletions controllers/dynamicenv_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,6 @@ func (r *DynamicEnvReconciler) addFinalizersIfRequired(ctx context.Context, de *
return nil
}

func (r *DynamicEnvReconciler) deleteFinalizer(ctx context.Context, finalizer string, de *riskifiedv1alpha1.DynamicEnv) error {
log.Info("Deleting finalizer from dynamic env", "finalizer", finalizer)
remainingFinalizers := helpers.RemoveItemFromStringSlice(finalizer, de.Finalizers)
de.Finalizers = remainingFinalizers
if err := r.Update(ctx, de); err != nil {
return fmt.Errorf("error removing %s finalizer: %w", finalizer, err)
}
return nil
}

// SetupWithManager sets up the controller with the Manager.
func (r *DynamicEnvReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
Expand Down
12 changes: 6 additions & 6 deletions pkg/handlers/deployment_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var _ = Describe("DeploymentHandler", func() {
}
handler := mkDeploymentHandler("unique", "my-namespace", mc)
expected := mkExpected(handler, riskifiedv1alpha1.Missing)
result, _ := handler.GetStatus(nil)
result, _ := handler.GetStatus(context.Background())
Expect(result).To(Equal(expected))
})

Expand All @@ -108,7 +108,7 @@ var _ = Describe("DeploymentHandler", func() {
}
handler := mkDeploymentHandler("unique", "my-namespace", mc)
expected := mkExpected(handler, riskifiedv1alpha1.Running)
result, _ := handler.GetStatus(nil)
result, _ := handler.GetStatus(context.Background())
Expect(result).To(Equal(expected))
})

Expand All @@ -127,7 +127,7 @@ var _ = Describe("DeploymentHandler", func() {
}
handler := mkDeploymentHandler("unique", "my-namespace", mc)
expected := mkExpected(handler, riskifiedv1alpha1.Initializing)
result, _ := handler.GetStatus(nil)
result, _ := handler.GetStatus(context.Background())
Expect(result).To(Equal(expected))
})
})
Expand Down Expand Up @@ -155,7 +155,7 @@ var _ = Describe("DeploymentHandler", func() {
}
handler := mkDeploymentHandler("unavailable1", "my-namespace", mc)
expected := mkExpected(handler, riskifiedv1alpha1.Initializing)
result, _ := handler.GetStatus(nil)
result, _ := handler.GetStatus(context.Background())
Expect(result).To(Equal(expected))
})

Expand All @@ -173,7 +173,7 @@ var _ = Describe("DeploymentHandler", func() {
}
handler := mkDeploymentHandler("unique", "my-namespace", mc)
expected := mkExpected(handler, riskifiedv1alpha1.Failed)
result, _ := handler.GetStatus(nil)
result, _ := handler.GetStatus(context.Background())
Expect(result).To(Equal(expected))
})

Expand Down Expand Up @@ -206,7 +206,7 @@ var _ = Describe("DeploymentHandler", func() {
handler.SubsetName = fmt.Sprintf("%s/%s", de.Spec.Subsets[0].Namespace, de.Spec.Subsets[0].Name)
subset := de.Spec.Subsets[0].DeepCopy()
handler.Subset = *subset
errorResult := handler.UpdateIfRequired(nil)
errorResult := handler.UpdateIfRequired(context.Background())
Expect(errorResult).To(BeNil())
Expect(handler.Updating).To(BeFalse())
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/destinationrule_handler_private_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = Describe("Accepting alternative version label and version", func() {
Owner: types.NamespacedName{},
Log: logr.Logger{},
}
dr, err := h.generateOverridingDestinationRule(nil, serviceName)
dr, err := h.generateOverridingDestinationRule(context.Background(), serviceName)
Expect(err).To(BeNil())
Expect(dr).NotTo(BeNil())
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/virtualservice_handler_private_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ var _ = Describe("VirtualServiceHandler", func() {
Status: riskifiedv1alpha1.IgnoredMissingVS,
},
}
result, err := handler.GetStatus(nil)
result, err := handler.GetStatus(context.Background())
Expect(err).To(BeNil())
Expect(result).To(Equal(expected))
})
Expand Down Expand Up @@ -338,7 +338,7 @@ var _ = Describe("VirtualServiceHandler", func() {
Status: riskifiedv1alpha1.Running,
},
}
result, err := handler.GetStatus(nil)
result, err := handler.GetStatus(context.Background())
Expect(err).To(BeNil())
Expect(result).To(Equal(expected))
})
Expand Down

0 comments on commit 4905918

Please sign in to comment.