diff --git a/.golangci.yml b/.golangci.yml index 1b496f0326..ce74489a5b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -97,6 +97,7 @@ linters: - nilnil - noctx - nolintlint + - paralleltest - predeclared - promlinter - reassign diff --git a/internal/mode/static/state/graph/backend_refs_test.go b/internal/mode/static/state/graph/backend_refs_test.go index b4e5b2cf3c..ea0883ac29 100644 --- a/internal/mode/static/state/graph/backend_refs_test.go +++ b/internal/mode/static/state/graph/backend_refs_test.go @@ -398,6 +398,7 @@ func TestVerifyIPFamily(t *testing.T) { } func TestAddBackendRefsToRulesTest(t *testing.T) { + t.Parallel() sectionNameRefs := []ParentRef{ { Idx: 0, @@ -741,6 +742,7 @@ func TestAddBackendRefsToRulesTest(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) resolver := newReferenceGrantResolver(nil) addBackendRefsToRules(test.route, resolver, services, test.policies, nil) diff --git a/internal/mode/static/state/graph/backend_tls_policy_test.go b/internal/mode/static/state/graph/backend_tls_policy_test.go index 791b8f8ffc..a7b20d54cc 100644 --- a/internal/mode/static/state/graph/backend_tls_policy_test.go +++ b/internal/mode/static/state/graph/backend_tls_policy_test.go @@ -83,6 +83,7 @@ func TestProcessBackendTLSPoliciesEmpty(t *testing.T) { } func TestValidateBackendTLSPolicy(t *testing.T) { + t.Parallel() targetRefNormalCase := []v1alpha2.LocalPolicyTargetReferenceWithSectionName{ { LocalPolicyTargetReference: v1alpha2.LocalPolicyTargetReference{ @@ -408,6 +409,7 @@ func TestValidateBackendTLSPolicy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) valid, ignored, conds := validateBackendTLSPolicy(test.tlsPolicy, configMapResolver, "test") diff --git a/internal/mode/static/state/graph/configmaps_test.go b/internal/mode/static/state/graph/configmaps_test.go index 852d7c8917..a0953766f4 100644 --- a/internal/mode/static/state/graph/configmaps_test.go +++ b/internal/mode/static/state/graph/configmaps_test.go @@ -135,6 +135,7 @@ func TestValidateCA(t *testing.T) { } func TestResolve(t *testing.T) { + t.Parallel() configMaps := map[types.NamespacedName]*v1.ConfigMap{ {Namespace: "test", Name: "configmap1"}: { ObjectMeta: metav1.ObjectMeta{ @@ -210,6 +211,7 @@ func TestResolve(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := configMapResolver.resolve(test.nsname) diff --git a/internal/mode/static/state/graph/gateway_test.go b/internal/mode/static/state/graph/gateway_test.go index 36021e6dc3..2db4e39780 100644 --- a/internal/mode/static/state/graph/gateway_test.go +++ b/internal/mode/static/state/graph/gateway_test.go @@ -145,6 +145,7 @@ func TestProcessGateways(t *testing.T) { } func TestBuildGateway(t *testing.T) { + t.Parallel() const gcName = "my-gateway-class" labelSet := map[string]string{ @@ -1034,6 +1035,7 @@ func TestBuildGateway(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) resolver := newReferenceGrantResolver(test.refGrants) result := buildGateway(test.gateway, secretResolver, test.gatewayClass, resolver, protectedPorts) diff --git a/internal/mode/static/state/graph/graph_test.go b/internal/mode/static/state/graph/graph_test.go index 6250e20b58..ae27059e01 100644 --- a/internal/mode/static/state/graph/graph_test.go +++ b/internal/mode/static/state/graph/graph_test.go @@ -30,6 +30,7 @@ import ( ) func TestBuildGraph(t *testing.T) { + t.Parallel() const ( gcName = "my-class" controllerName = "my.controller" @@ -854,6 +855,7 @@ func TestBuildGraph(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) // The diffs get very large so the format max length will make sure the output doesn't get truncated. @@ -879,6 +881,7 @@ func TestBuildGraph(t *testing.T) { } func TestIsReferenced(t *testing.T) { + t.Parallel() baseSecret := &v1.Secret{ ObjectMeta: metav1.ObjectMeta{ Namespace: testNs, @@ -1172,6 +1175,7 @@ func TestIsReferenced(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) test.graph.GatewayClass = test.gc diff --git a/internal/mode/static/state/graph/route_common_test.go b/internal/mode/static/state/graph/route_common_test.go index f96e820bb7..b3b06eb4fd 100644 --- a/internal/mode/static/state/graph/route_common_test.go +++ b/internal/mode/static/state/graph/route_common_test.go @@ -226,6 +226,7 @@ func TestFindGatewayForParentRef(t *testing.T) { } func TestBindRouteToListeners(t *testing.T) { + t.Parallel() // we create a new listener each time because the function under test can modify it createListener := func(name string) *Listener { return &Listener{ @@ -1223,6 +1224,7 @@ func TestBindRouteToListeners(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) bindL7RouteToListeners(