diff --git a/internal/framework/controller/controller_suite_test.go b/internal/framework/controller/controller_suite_test.go index 2a0ef5ee0e..6e27263c66 100644 --- a/internal/framework/controller/controller_suite_test.go +++ b/internal/framework/controller/controller_suite_test.go @@ -8,6 +8,7 @@ import ( ) func TestControllers(t *testing.T) { + t.Parallel() RegisterFailHandler(Fail) RunSpecs(t, "Controller Suite") } diff --git a/internal/framework/controller/filter/filter_test.go b/internal/framework/controller/filter/filter_test.go index d9638aeb8d..d250dd312e 100644 --- a/internal/framework/controller/filter/filter_test.go +++ b/internal/framework/controller/filter/filter_test.go @@ -8,6 +8,7 @@ import ( ) func TestCreateSingleResourceFilter(t *testing.T) { + t.Parallel() targetNsName := types.NamespacedName{Namespace: "test", Name: "resource"} g := NewWithT(t) @@ -50,7 +51,9 @@ func TestCreateSingleResourceFilter(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) shouldProcess, msg := filter(test.nsname) g.Expect(shouldProcess).To(Equal(test.expectedShouldProcess)) diff --git a/internal/framework/controller/index/endpointslice_test.go b/internal/framework/controller/index/endpointslice_test.go index 23e09dbf41..10531fb333 100644 --- a/internal/framework/controller/index/endpointslice_test.go +++ b/internal/framework/controller/index/endpointslice_test.go @@ -11,6 +11,7 @@ import ( ) func TestServiceNameIndexFunc(t *testing.T) { + t.Parallel() testcases := []struct { msg string obj client.Object @@ -42,13 +43,19 @@ func TestServiceNameIndexFunc(t *testing.T) { } for _, tc := range testcases { - g := NewWithT(t) - output := ServiceNameIndexFunc(tc.obj) - g.Expect(output).To(Equal(tc.expOutput)) + tc := tc + t.Run(tc.msg, func(t *testing.T) { + t.Parallel() + g := NewWithT(t) + + output := ServiceNameIndexFunc(tc.obj) + g.Expect(output).To(Equal(tc.expOutput)) + }) } } func TestServiceNameIndexFuncPanics(t *testing.T) { + t.Parallel() defer func() { g := NewWithT(t) g.Expect(recover()).ToNot(BeNil()) diff --git a/internal/framework/controller/predicate/annotation_test.go b/internal/framework/controller/predicate/annotation_test.go index 6fe18b3a28..619b6e68aa 100644 --- a/internal/framework/controller/predicate/annotation_test.go +++ b/internal/framework/controller/predicate/annotation_test.go @@ -10,6 +10,7 @@ import ( ) func TestAnnotationPredicate_Create(t *testing.T) { + t.Parallel() annotation := "test" tests := []struct { @@ -58,7 +59,9 @@ func TestAnnotationPredicate_Create(t *testing.T) { p := AnnotationPredicate{Annotation: annotation} for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) update := p.Create(test.event) g.Expect(update).To(Equal(test.expUpdate)) @@ -67,6 +70,7 @@ func TestAnnotationPredicate_Create(t *testing.T) { } func TestAnnotationPredicate_Update(t *testing.T) { + t.Parallel() annotation := "test" tests := []struct { @@ -211,7 +215,9 @@ func TestAnnotationPredicate_Update(t *testing.T) { p := AnnotationPredicate{Annotation: annotation} for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) update := p.Update(test.event) g.Expect(update).To(Equal(test.expUpdate)) diff --git a/internal/framework/controller/predicate/gatewayclass_test.go b/internal/framework/controller/predicate/gatewayclass_test.go index e89d974f00..91d2bad8bd 100644 --- a/internal/framework/controller/predicate/gatewayclass_test.go +++ b/internal/framework/controller/predicate/gatewayclass_test.go @@ -9,6 +9,7 @@ import ( ) func TestGatewayClassPredicate(t *testing.T) { + t.Parallel() g := NewWithT(t) p := GatewayClassPredicate{ControllerName: "nginx-ctlr"} diff --git a/internal/framework/controller/predicate/service_test.go b/internal/framework/controller/predicate/service_test.go index 90bda2fd2d..7933ac5c8b 100644 --- a/internal/framework/controller/predicate/service_test.go +++ b/internal/framework/controller/predicate/service_test.go @@ -13,6 +13,7 @@ import ( ) func TestServicePortsChangedPredicate_Update(t *testing.T) { + t.Parallel() testcases := []struct { objectOld client.Object objectNew client.Object @@ -227,7 +228,9 @@ func TestServicePortsChangedPredicate_Update(t *testing.T) { p := ServicePortsChangedPredicate{} for _, tc := range testcases { + tc := tc t.Run(tc.msg, func(t *testing.T) { + t.Parallel() g := NewWithT(t) update := p.Update(event.UpdateEvent{ ObjectOld: tc.objectOld, @@ -240,6 +243,7 @@ func TestServicePortsChangedPredicate_Update(t *testing.T) { } func TestServicePortsChangedPredicate(t *testing.T) { + t.Parallel() g := NewWithT(t) p := GatewayServicePredicate{} @@ -250,6 +254,7 @@ func TestServicePortsChangedPredicate(t *testing.T) { } func TestGatewayServicePredicate_Update(t *testing.T) { + t.Parallel() testcases := []struct { objectOld client.Object objectNew client.Object @@ -440,7 +445,9 @@ func TestGatewayServicePredicate_Update(t *testing.T) { p := GatewayServicePredicate{NSName: types.NamespacedName{Namespace: "nginx-gateway", Name: "nginx"}} for _, tc := range testcases { + tc := tc t.Run(tc.msg, func(t *testing.T) { + t.Parallel() g := NewWithT(t) update := p.Update(event.UpdateEvent{ ObjectOld: tc.objectOld, @@ -453,6 +460,7 @@ func TestGatewayServicePredicate_Update(t *testing.T) { } func TestGatewayServicePredicate(t *testing.T) { + t.Parallel() g := NewWithT(t) p := GatewayServicePredicate{} diff --git a/internal/framework/controller/register_test.go b/internal/framework/controller/register_test.go index f9cfc06cd6..049bc727b4 100644 --- a/internal/framework/controller/register_test.go +++ b/internal/framework/controller/register_test.go @@ -27,6 +27,7 @@ import ( ) func TestRegister(t *testing.T) { + t.Parallel() type fakes struct { mgr *controllerfakes.FakeManager indexer *controllerfakes.FakeFieldIndexer @@ -120,7 +121,9 @@ func TestRegister(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.msg, func(t *testing.T) { + t.Parallel() g := NewWithT(t) newReconciler := func(c controller.ReconcilerConfig) *controller.Reconciler { diff --git a/internal/framework/status/conditions_test.go b/internal/framework/status/conditions_test.go index c3d788e69d..838e068019 100644 --- a/internal/framework/status/conditions_test.go +++ b/internal/framework/status/conditions_test.go @@ -9,6 +9,7 @@ import ( ) func TestConditionsEqual(t *testing.T) { + t.Parallel() getDefaultConds := func() []v1.Condition { return []v1.Condition{ { @@ -110,7 +111,9 @@ func TestConditionsEqual(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) equal := ConditionsEqual(test.prevConds, test.curConds) g.Expect(equal).To(Equal(test.expEqual)) diff --git a/internal/framework/status/status_suite_test.go b/internal/framework/status/status_suite_test.go index b2dad44818..9dae71aec2 100644 --- a/internal/framework/status/status_suite_test.go +++ b/internal/framework/status/status_suite_test.go @@ -8,6 +8,7 @@ import ( ) func TestStatus(t *testing.T) { + t.Parallel() RegisterFailHandler(Fail) RunSpecs(t, "Status Suite") } diff --git a/internal/framework/status/updater_retry_test.go b/internal/framework/status/updater_retry_test.go index 69a8b5e388..5c6fa67b05 100644 --- a/internal/framework/status/updater_retry_test.go +++ b/internal/framework/status/updater_retry_test.go @@ -19,6 +19,7 @@ import ( ) func TestNewRetryUpdateFunc(t *testing.T) { + t.Parallel() tests := []struct { getReturns error updateReturns error @@ -70,7 +71,9 @@ func TestNewRetryUpdateFunc(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) fakeStatusUpdater := &statusfakes.FakeK8sUpdater{}