Skip to content

Commit ea7ef87

Browse files
authored
Run tests in parallel (#2537)
1 parent 74724a6 commit ea7ef87

22 files changed

+83
-0
lines changed

internal/mode/provisioner/provisioner_suite_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
func TestProvisioner(t *testing.T) {
11+
t.Parallel()
1112
RegisterFailHandler(Fail)
1213
RunSpecs(t, "Provisioner Suite")
1314
}

internal/mode/static/config_updater_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func TestUpdateControlPlane(t *testing.T) {
103103
}
104104

105105
func TestValidateLogLevel(t *testing.T) {
106+
t.Parallel()
106107
validLevels := []ngfAPI.ControllerLogLevel{
107108
ngfAPI.ControllerLogLevelError,
108109
ngfAPI.ControllerLogLevelInfo,
@@ -125,6 +126,7 @@ func TestValidateLogLevel(t *testing.T) {
125126

126127
for _, level := range invalidLevels {
127128
t.Run(fmt.Sprintf("invalid level %q", level), func(t *testing.T) {
129+
t.Parallel()
128130
g := NewWithT(t)
129131

130132
g.Expect(validateLogLevel(level)).ToNot(Succeed())

internal/mode/static/health_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
)
88

99
func TestReadyCheck(t *testing.T) {
10+
t.Parallel()
1011
g := NewWithT(t)
1112
nginxChecker := newNginxConfiguredOnStartChecker()
1213
g.Expect(nginxChecker.readyCheck(nil)).ToNot(Succeed())

internal/mode/static/log_level_setters_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func TestMultiLogLevelSetter_SetLevel(t *testing.T) {
14+
t.Parallel()
1415
g := NewWithT(t)
1516

1617
logr1 := &staticfakes.FakeLogLevelSetter{}
@@ -41,6 +42,7 @@ func TestMultiLogLevelSetter_SetLevel(t *testing.T) {
4142
}
4243

4344
func TestZapLogLevelSetter_SetLevel(t *testing.T) {
45+
t.Parallel()
4446
g := NewWithT(t)
4547

4648
zapSetter := newZapLogLevelSetter(zap.NewAtomicLevel())
@@ -58,6 +60,7 @@ func TestZapLogLevelSetter_SetLevel(t *testing.T) {
5860
}
5961

6062
func TestPromLogLevelSetter_SetLevel(t *testing.T) {
63+
t.Parallel()
6164
g := NewWithT(t)
6265

6366
logger, err := newLeveledPrometheusLogger()

internal/mode/static/manager_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
)
2323

2424
func TestPrepareFirstEventBatchPreparerArgs(t *testing.T) {
25+
t.Parallel()
2526
const gcName = "nginx"
2627

2728
partialObjectMetadataList := &metav1.PartialObjectMetadataList{}
@@ -117,6 +118,7 @@ func TestPrepareFirstEventBatchPreparerArgs(t *testing.T) {
117118

118119
for _, test := range tests {
119120
t.Run(test.name, func(t *testing.T) {
121+
t.Parallel()
120122
g := NewWithT(t)
121123

122124
objects, objectLists := prepareFirstEventBatchPreparerArgs(gcName, test.gwNsName, test.experimentalEnabled)
@@ -128,6 +130,7 @@ func TestPrepareFirstEventBatchPreparerArgs(t *testing.T) {
128130
}
129131

130132
func TestGetMetricsOptions(t *testing.T) {
133+
t.Parallel()
131134
tests := []struct {
132135
name string
133136
expectedOptions metricsserver.Options
@@ -166,6 +169,7 @@ func TestGetMetricsOptions(t *testing.T) {
166169

167170
for _, test := range tests {
168171
t.Run(test.name, func(t *testing.T) {
172+
t.Parallel()
169173
g := NewWithT(t)
170174

171175
metricsServerOptions := getMetricsOptions(test.metricsConfig)

internal/mode/static/nginx/file/file_suite_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
func TestFile(t *testing.T) {
11+
t.Parallel()
1112
RegisterFailHandler(Fail)
1213
RunSpecs(t, "File Suite")
1314
}

internal/mode/static/nginx/file/folders_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func writeFile(t *testing.T, name string, data []byte) {
2121
}
2222

2323
func TestClearFoldersRemoves(t *testing.T) {
24+
t.Parallel()
2425
g := NewWithT(t)
2526

2627
tempDir := t.TempDir()
@@ -41,6 +42,7 @@ func TestClearFoldersRemoves(t *testing.T) {
4142
}
4243

4344
func TestClearFoldersFails(t *testing.T) {
45+
t.Parallel()
4446
files := []string{"file"}
4547

4648
testErr := errors.New("test error")
@@ -78,6 +80,7 @@ func TestClearFoldersFails(t *testing.T) {
7880

7981
for _, test := range tests {
8082
t.Run(test.name, func(t *testing.T) {
83+
t.Parallel()
8184
g := NewWithT(t)
8285

8386
removedFiles, err := file.ClearFolders(test.fileMgr, files)

internal/mode/static/nginx/runtime/manager_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ var _ = Describe("NGINX Runtime Manager", func() {
223223
})
224224

225225
func TestFindMainProcess(t *testing.T) {
226+
t.Parallel()
226227
readFileFuncGen := func(content []byte) runtime.ReadFileFunc {
227228
return func(name string) ([]byte, error) {
228229
if name != runtime.PidFile {
@@ -311,6 +312,7 @@ func TestFindMainProcess(t *testing.T) {
311312

312313
for _, test := range tests {
313314
t.Run(test.name, func(t *testing.T) {
315+
t.Parallel()
314316
g := NewWithT(t)
315317
p := runtime.NewProcessHandlerImpl(
316318
test.readFile,

internal/mode/static/nginx/runtime/runtime_suite_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
)
99

1010
func TestRuntime(t *testing.T) {
11+
t.Parallel()
1112
RegisterFailHandler(Fail)
1213
RunSpecs(t, "Runtime Suite")
1314
}

internal/mode/static/nginx/runtime/verify_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func getTestHTTPClient() *http.Client {
3030
}
3131

3232
func TestVerifyClient(t *testing.T) {
33+
t.Parallel()
3334
c := VerifyClient{
3435
client: getTestHTTPClient(),
3536
timeout: 25 * time.Millisecond,
@@ -87,6 +88,7 @@ func TestVerifyClient(t *testing.T) {
8788

8889
for _, test := range tests {
8990
t.Run(test.name, func(t *testing.T) {
91+
t.Parallel()
9092
g := NewWithT(t)
9193

9294
err := c.WaitForCorrectVersion(test.ctx, test.expectedVersion, "/childfile", []byte("1 2 3"), test.readFile)
@@ -101,6 +103,7 @@ func TestVerifyClient(t *testing.T) {
101103
}
102104

103105
func TestEnsureNewNginxWorkers(t *testing.T) {
106+
t.Parallel()
104107
previousContents := []byte("1 2 3")
105108
newContents := []byte("4 5 6")
106109

@@ -163,6 +166,7 @@ func TestEnsureNewNginxWorkers(t *testing.T) {
163166

164167
for _, test := range tests {
165168
t.Run(test.name, func(t *testing.T) {
169+
t.Parallel()
166170
g := NewWithT(t)
167171

168172
err := ensureNewNginxWorkers(

0 commit comments

Comments
 (0)