Skip to content

Commit

Permalink
Fix golang-lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Sep 18, 2023
1 parent 813cf2e commit 6fd6578
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions pkg/reconciler/ingress/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ func TestReconcileTLS(t *testing.T) {
Name: "Happy TLS",
Key: "ns/name",
Objects: []runtime.Object{
ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName)),
ing(withBasicSpec, withGatewayAPIClass, withTLS()),
secret(secretName, nsName),
gw(defaultListener),
},
WantCreates: []runtime.Object{
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())),
rp(secret(secretName, nsName)),
},
WantUpdates: []clientgotesting.UpdateActionImpl{{
Expand All @@ -294,7 +294,7 @@ func TestReconcileTLS(t *testing.T) {
Patch: []byte(`{"metadata":{"finalizers":["ingresses.networking.internal.knative.dev"],"resourceVersion":""}}`),
}},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) {
Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) {
i.Status.InitializeConditions()
i.Status.MarkLoadBalancerReady(
[]v1alpha1.LoadBalancerIngressStatus{{
Expand All @@ -313,17 +313,17 @@ func TestReconcileTLS(t *testing.T) {
Name: "Already Configured",
Key: "ns/name",
Objects: []runtime.Object{
ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS(secretName)),
ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS()),
secret(secretName, nsName),
gw(defaultListener, tlsListener("secure.example.com", nsName, secretName)),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())),
rp(secret(secretName, nsName)),
},
WantUpdates: []clientgotesting.UpdateActionImpl{
// None
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) {
Object: ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) {
i.Status.InitializeConditions()
i.Status.MarkLoadBalancerReady(
[]v1alpha1.LoadBalancerIngressStatus{{
Expand All @@ -342,14 +342,14 @@ func TestReconcileTLS(t *testing.T) {
Key: "ns/name",
SkipNamespaceValidation: true,
Objects: []runtime.Object{
ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) {
ing(withBasicSpec, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) {
i.DeletionTimestamp = &metav1.Time{
Time: deleteTime,
}
}),
secret(secretName, nsName),
gw(defaultListener, tlsListener("secure.example.com", nsName, secretName)),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())),
rp(secret(secretName, nsName)),
},
WantUpdates: []clientgotesting.UpdateActionImpl{{
Expand All @@ -360,11 +360,11 @@ func TestReconcileTLS(t *testing.T) {
Key: "ns/name",
WantErr: true,
Objects: []runtime.Object{
ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName)),
ing(withBasicSpec, withGatewayAPIClass, withTLS()),
secret(secretName, nsName),
},
WantCreates: []runtime.Object{
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName))),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())),
rp(secret(secretName, nsName)),
},
WantUpdates: []clientgotesting.UpdateActionImpl{
Expand All @@ -378,7 +378,7 @@ func TestReconcileTLS(t *testing.T) {
Patch: []byte(`{"metadata":{"finalizers":["ingresses.networking.internal.knative.dev"],"resourceVersion":""}}`),
}},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(secretName), func(i *v1alpha1.Ingress) {
Object: ing(withBasicSpec, withGatewayAPIClass, withTLS(), func(i *v1alpha1.Ingress) {
i.Status.InitializeConditions()
i.Status.MarkIngressNotReady("ReconcileIngressFailed", "Ingress reconciliation failed")
}),
Expand Down Expand Up @@ -599,7 +599,7 @@ var withFinalizer = func(i *v1alpha1.Ingress) {
i.Finalizers = append(i.Finalizers, "ingresses.networking.internal.knative.dev")
}

func withTLS(secret string) IngressOption {
func withTLS() IngressOption {
return func(i *v1alpha1.Ingress) {
i.Spec.TLS = append(i.Spec.TLS, v1alpha1.IngressTLS{
Hosts: []string{"secure.example.com"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/ingress/resources/reference_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

// Grant the resource "to" access to the resource "from"
func MakeReferenceGrant(ctx context.Context, ing *netv1alpha1.Ingress, to, from metav1.PartialObjectMetadata) *gatewayv1alpha2.ReferenceGrant {
func MakeReferenceGrant(_ context.Context, ing *netv1alpha1.Ingress, to, from metav1.PartialObjectMetadata) *gatewayv1alpha2.ReferenceGrant {

Check warning on line 29 in pkg/reconciler/ingress/resources/reference_grant.go

View check run for this annotation

Codecov / codecov/patch

pkg/reconciler/ingress/resources/reference_grant.go#L29

Added line #L29 was not covered by tests
name := to.Name
if len(name)+len(from.Namespace) > 62 {
name = name[:62-len(from.Namespace)]
Expand Down

0 comments on commit 6fd6578

Please sign in to comment.