diff --git a/.golangci.yml b/.golangci.yml index 730b7f583..f8ba1c5f6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -88,6 +88,7 @@ linters: - stylecheck - tenv - thelper + - tparallel - typecheck - unconvert - unparam diff --git a/cmd/gateway/commands_test.go b/cmd/gateway/commands_test.go index 988cf2b98..27c941fc0 100644 --- a/cmd/gateway/commands_test.go +++ b/cmd/gateway/commands_test.go @@ -56,6 +56,7 @@ This test cannot be run with ginkgo. Ginkgo reports the following error: * See https://github.com/spf13/cobra/issues/2104. */ func TestRootCmd(t *testing.T) { + t.Parallel() testCase := flagTestCase{ name: "no flags", args: nil, @@ -66,6 +67,7 @@ func TestRootCmd(t *testing.T) { } func TestCommonFlagsValidation(t *testing.T) { + t.Parallel() tests := []flagTestCase{ { name: "valid flags", @@ -131,16 +133,20 @@ func TestCommonFlagsValidation(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name+"_static_mode", func(t *testing.T) { + t.Parallel() testFlag(t, createStaticModeCommand(), test) }) t.Run(test.name+"_provisioner_mode", func(t *testing.T) { + t.Parallel() testFlag(t, createProvisionerModeCommand(), test) }) } } func TestStaticModeCmdFlagValidation(t *testing.T) { + t.Parallel() tests := []flagTestCase{ { name: "valid flags", @@ -381,7 +387,9 @@ func TestStaticModeCmdFlagValidation(t *testing.T) { // common flags validation is tested separately for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() cmd := createStaticModeCommand() testFlag(t, cmd, test) }) @@ -389,6 +397,7 @@ func TestStaticModeCmdFlagValidation(t *testing.T) { } func TestProvisionerModeCmdFlagValidation(t *testing.T) { + t.Parallel() testCase := flagTestCase{ name: "valid flags", args: []string{ @@ -419,6 +428,7 @@ This test cannot be run with ginkgo. Ginkgo reports the following error for the * See https://github.com/spf13/cobra/issues/2104. */ func TestSleepCmdFlagValidation(t *testing.T) { + t.Parallel() tests := []flagTestCase{ { name: "valid flags", @@ -451,7 +461,9 @@ func TestSleepCmdFlagValidation(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() cmd := createSleepCommand() testFlag(t, cmd, test) }) @@ -459,6 +471,7 @@ func TestSleepCmdFlagValidation(t *testing.T) { } func TestParseFlags(t *testing.T) { + t.Parallel() g := NewWithT(t) flagSet := pflag.NewFlagSet("flagSet", 0) diff --git a/cmd/gateway/validation_test.go b/cmd/gateway/validation_test.go index f19e3ac84..3b0e27369 100644 --- a/cmd/gateway/validation_test.go +++ b/cmd/gateway/validation_test.go @@ -8,6 +8,7 @@ import ( ) func TestValidateGatewayControllerName(t *testing.T) { + t.Parallel() tests := []struct { name string value string @@ -51,7 +52,9 @@ func TestValidateGatewayControllerName(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateGatewayControllerName(test.value) @@ -66,6 +69,7 @@ func TestValidateGatewayControllerName(t *testing.T) { } func TestValidateResourceName(t *testing.T) { + t.Parallel() tests := []struct { name string value string @@ -114,7 +118,9 @@ func TestValidateResourceName(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateResourceName(test.value) @@ -129,6 +135,7 @@ func TestValidateResourceName(t *testing.T) { } func TestValidateNamespaceName(t *testing.T) { + t.Parallel() tests := []struct { name string value string @@ -177,7 +184,9 @@ func TestValidateNamespaceName(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateNamespaceName(test.value) @@ -192,6 +201,7 @@ func TestValidateNamespaceName(t *testing.T) { } func TestParseNamespacedResourceName(t *testing.T) { + t.Parallel() tests := []struct { name string value string @@ -239,7 +249,9 @@ func TestParseNamespacedResourceName(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) nsName, err := parseNamespacedResourceName(test.value) @@ -256,6 +268,7 @@ func TestParseNamespacedResourceName(t *testing.T) { } func TestValidateQualifiedName(t *testing.T) { + t.Parallel() tests := []struct { name string value string @@ -304,7 +317,9 @@ func TestValidateQualifiedName(t *testing.T) { } for _, test := range tests { + test := test t.Run(test.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateQualifiedName(test.value) @@ -318,6 +333,7 @@ func TestValidateQualifiedName(t *testing.T) { } func TestValidateURL(t *testing.T) { + t.Parallel() tests := []struct { name string url string @@ -366,7 +382,9 @@ func TestValidateURL(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateURL(tc.url) @@ -380,6 +398,7 @@ func TestValidateURL(t *testing.T) { } func TestValidateIP(t *testing.T) { + t.Parallel() tests := []struct { name string expSubMsg string @@ -406,7 +425,9 @@ func TestValidateIP(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateIP(tc.ip) @@ -420,6 +441,7 @@ func TestValidateIP(t *testing.T) { } func TestValidateEndpoint(t *testing.T) { + t.Parallel() tests := []struct { name string endp string @@ -473,7 +495,9 @@ func TestValidateEndpoint(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validateEndpoint(tc.endp) @@ -487,6 +511,7 @@ func TestValidateEndpoint(t *testing.T) { } func TestValidatePort(t *testing.T) { + t.Parallel() tests := []struct { name string port int @@ -510,7 +535,9 @@ func TestValidatePort(t *testing.T) { } for _, tc := range tests { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() g := NewWithT(t) err := validatePort(tc.port) @@ -524,6 +551,7 @@ func TestValidatePort(t *testing.T) { } func TestEnsureNoPortCollisions(t *testing.T) { + t.Parallel() g := NewWithT(t) g.Expect(ensureNoPortCollisions(9113, 8081)).To(Succeed())