diff --git a/pkg/api/service/util_test.go b/pkg/api/service/util_test.go index a0fc76861b5..d562a4d2481 100644 --- a/pkg/api/service/util_test.go +++ b/pkg/api/service/util_test.go @@ -26,6 +26,7 @@ import ( func TestGetLoadBalancerSourceRanges(t *testing.T) { checkError := func(v string) { + t.Helper() annotations := make(map[string]string) annotations[api.AnnotationLoadBalancerSourceRangesKey] = v svc := api.Service{} @@ -49,6 +50,7 @@ func TestGetLoadBalancerSourceRanges(t *testing.T) { checkError("10.0.0.1") checkOK := func(v string) utilnet.IPNetSet { + t.Helper() annotations := make(map[string]string) annotations[api.AnnotationLoadBalancerSourceRangesKey] = v svc := api.Service{} @@ -112,6 +114,7 @@ func TestGetLoadBalancerSourceRanges(t *testing.T) { func TestAllowAll(t *testing.T) { checkAllowAll := func(allowAll bool, cidrs ...string) { + t.Helper() ipnets, err := utilnet.ParseIPNets(cidrs...) if err != nil { t.Errorf("Unexpected error parsing cidrs: %v", cidrs) @@ -131,6 +134,7 @@ func TestAllowAll(t *testing.T) { func TestExternallyAccessible(t *testing.T) { checkExternallyAccessible := func(expect bool, service *api.Service) { + t.Helper() res := ExternallyAccessible(service) if res != expect { t.Errorf("Expected ExternallyAccessible = %v, got %v", expect, res) @@ -174,6 +178,7 @@ func TestExternallyAccessible(t *testing.T) { func TestRequestsOnlyLocalTraffic(t *testing.T) { checkRequestsOnlyLocalTraffic := func(requestsOnlyLocalTraffic bool, service *api.Service) { + t.Helper() res := RequestsOnlyLocalTraffic(service) if res != requestsOnlyLocalTraffic { t.Errorf("Expected requests OnlyLocal traffic = %v, got %v", @@ -220,6 +225,7 @@ func TestRequestsOnlyLocalTraffic(t *testing.T) { func TestNeedsHealthCheck(t *testing.T) { checkNeedsHealthCheck := func(needsHealthCheck bool, service *api.Service) { + t.Helper() res := NeedsHealthCheck(service) if res != needsHealthCheck { t.Errorf("Expected needs health check = %v, got %v", diff --git a/pkg/api/v1/service/util_test.go b/pkg/api/v1/service/util_test.go index 5d9f02bc5de..988b69a244b 100644 --- a/pkg/api/v1/service/util_test.go +++ b/pkg/api/v1/service/util_test.go @@ -26,6 +26,7 @@ import ( func TestGetLoadBalancerSourceRanges(t *testing.T) { checkError := func(v string) { + t.Helper() annotations := make(map[string]string) annotations[v1.AnnotationLoadBalancerSourceRangesKey] = v svc := v1.Service{} @@ -49,6 +50,7 @@ func TestGetLoadBalancerSourceRanges(t *testing.T) { checkError("10.0.0.1") checkOK := func(v string) utilnet.IPNetSet { + t.Helper() annotations := make(map[string]string) annotations[v1.AnnotationLoadBalancerSourceRangesKey] = v svc := v1.Service{} @@ -112,6 +114,7 @@ func TestGetLoadBalancerSourceRanges(t *testing.T) { func TestAllowAll(t *testing.T) { checkAllowAll := func(allowAll bool, cidrs ...string) { + t.Helper() ipnets, err := utilnet.ParseIPNets(cidrs...) if err != nil { t.Errorf("Unexpected error parsing cidrs: %v", cidrs) @@ -131,6 +134,7 @@ func TestAllowAll(t *testing.T) { func TestExternallyAccessible(t *testing.T) { checkExternallyAccessible := func(expect bool, service *v1.Service) { + t.Helper() res := ExternallyAccessible(service) if res != expect { t.Errorf("Expected ExternallyAccessible = %v, got %v", expect, res) @@ -174,6 +178,7 @@ func TestExternallyAccessible(t *testing.T) { func TestExternalPolicyLocal(t *testing.T) { checkExternalPolicyLocal := func(requestsOnlyLocalTraffic bool, service *v1.Service) { + t.Helper() res := ExternalPolicyLocal(service) if res != requestsOnlyLocalTraffic { t.Errorf("Expected requests OnlyLocal traffic = %v, got %v", @@ -240,6 +245,7 @@ func TestExternalPolicyLocal(t *testing.T) { func TestNeedsHealthCheck(t *testing.T) { checkNeedsHealthCheck := func(needsHealthCheck bool, service *v1.Service) { + t.Helper() res := NeedsHealthCheck(service) if res != needsHealthCheck { t.Errorf("Expected needs health check = %v, got %v", @@ -280,6 +286,7 @@ func TestNeedsHealthCheck(t *testing.T) { func TestInternalPolicyLocal(t *testing.T) { checkInternalPolicyLocal := func(expected bool, service *v1.Service) { + t.Helper() res := InternalPolicyLocal(service) if res != expected { t.Errorf("Expected internal local traffic = %v, got %v",