Skip to content

Commit dc884c2

Browse files
authored
Add t.Parallel to unit tests (#3297)
1 parent 522c3ee commit dc884c2

File tree

165 files changed

+5487
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+5487
-1
lines changed

.golangci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ linters:
1111
- gosec
1212
- misspell
1313
- nakedret
14+
- paralleltest
1415
- stylecheck
16+
- tparallel
1517
- unconvert
1618
- unparam
1719
- whitespace
@@ -50,3 +52,7 @@ issues:
5052
- linters: [ gosec ]
5153
text: 'G304: Potential file inclusion via variable'
5254
path: '^(example|tools)\/'
55+
56+
# We don't run parallel integration tests
57+
- linters: [ paralleltest, tparallel ]
58+
path: '^test/integration'

github/actions_artifacts_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
)
1818

1919
func TestActionsService_ListArtifacts(t *testing.T) {
20+
t.Parallel()
2021
client, mux, _ := setup(t)
2122

2223
mux.HandleFunc("/repos/o/r/actions/artifacts", func(w http.ResponseWriter, r *http.Request) {
@@ -58,6 +59,7 @@ func TestActionsService_ListArtifacts(t *testing.T) {
5859
}
5960

6061
func TestActionsService_ListArtifacts_invalidOwner(t *testing.T) {
62+
t.Parallel()
6163
client, _, _ := setup(t)
6264

6365
ctx := context.Background()
@@ -66,6 +68,7 @@ func TestActionsService_ListArtifacts_invalidOwner(t *testing.T) {
6668
}
6769

6870
func TestActionsService_ListArtifacts_invalidRepo(t *testing.T) {
71+
t.Parallel()
6972
client, _, _ := setup(t)
7073

7174
ctx := context.Background()
@@ -74,6 +77,7 @@ func TestActionsService_ListArtifacts_invalidRepo(t *testing.T) {
7477
}
7578

7679
func TestActionsService_ListArtifacts_notFound(t *testing.T) {
80+
t.Parallel()
7781
client, mux, _ := setup(t)
7882

7983
mux.HandleFunc("/repos/o/r/actions/artifacts", func(w http.ResponseWriter, r *http.Request) {
@@ -95,6 +99,7 @@ func TestActionsService_ListArtifacts_notFound(t *testing.T) {
9599
}
96100

97101
func TestActionsService_ListWorkflowRunArtifacts(t *testing.T) {
102+
t.Parallel()
98103
client, mux, _ := setup(t)
99104

100105
mux.HandleFunc("/repos/o/r/actions/runs/1/artifacts", func(w http.ResponseWriter, r *http.Request) {
@@ -136,6 +141,7 @@ func TestActionsService_ListWorkflowRunArtifacts(t *testing.T) {
136141
}
137142

138143
func TestActionsService_ListWorkflowRunArtifacts_invalidOwner(t *testing.T) {
144+
t.Parallel()
139145
client, _, _ := setup(t)
140146

141147
ctx := context.Background()
@@ -144,6 +150,7 @@ func TestActionsService_ListWorkflowRunArtifacts_invalidOwner(t *testing.T) {
144150
}
145151

146152
func TestActionsService_ListWorkflowRunArtifacts_invalidRepo(t *testing.T) {
153+
t.Parallel()
147154
client, _, _ := setup(t)
148155

149156
ctx := context.Background()
@@ -152,6 +159,7 @@ func TestActionsService_ListWorkflowRunArtifacts_invalidRepo(t *testing.T) {
152159
}
153160

154161
func TestActionsService_ListWorkflowRunArtifacts_notFound(t *testing.T) {
162+
t.Parallel()
155163
client, mux, _ := setup(t)
156164

157165
mux.HandleFunc("/repos/o/r/actions/runs/1/artifacts", func(w http.ResponseWriter, r *http.Request) {
@@ -173,6 +181,7 @@ func TestActionsService_ListWorkflowRunArtifacts_notFound(t *testing.T) {
173181
}
174182

175183
func TestActionsService_GetArtifact(t *testing.T) {
184+
t.Parallel()
176185
client, mux, _ := setup(t)
177186

178187
mux.HandleFunc("/repos/o/r/actions/artifacts/1", func(w http.ResponseWriter, r *http.Request) {
@@ -219,6 +228,7 @@ func TestActionsService_GetArtifact(t *testing.T) {
219228
}
220229

221230
func TestActionsService_GetArtifact_invalidOwner(t *testing.T) {
231+
t.Parallel()
222232
client, _, _ := setup(t)
223233

224234
ctx := context.Background()
@@ -227,6 +237,7 @@ func TestActionsService_GetArtifact_invalidOwner(t *testing.T) {
227237
}
228238

229239
func TestActionsService_GetArtifact_invalidRepo(t *testing.T) {
240+
t.Parallel()
230241
client, _, _ := setup(t)
231242

232243
ctx := context.Background()
@@ -235,6 +246,7 @@ func TestActionsService_GetArtifact_invalidRepo(t *testing.T) {
235246
}
236247

237248
func TestActionsService_GetArtifact_notFound(t *testing.T) {
249+
t.Parallel()
238250
client, mux, _ := setup(t)
239251

240252
mux.HandleFunc("/repos/o/r/actions/artifacts/1", func(w http.ResponseWriter, r *http.Request) {
@@ -256,6 +268,7 @@ func TestActionsService_GetArtifact_notFound(t *testing.T) {
256268
}
257269

258270
func TestActionsService_DownloadArtifact(t *testing.T) {
271+
t.Parallel()
259272
client, mux, _ := setup(t)
260273

261274
mux.HandleFunc("/repos/o/r/actions/artifacts/1/zip", func(w http.ResponseWriter, r *http.Request) {
@@ -294,6 +307,7 @@ func TestActionsService_DownloadArtifact(t *testing.T) {
294307
}
295308

296309
func TestActionsService_DownloadArtifact_invalidOwner(t *testing.T) {
310+
t.Parallel()
297311
client, _, _ := setup(t)
298312

299313
ctx := context.Background()
@@ -302,6 +316,7 @@ func TestActionsService_DownloadArtifact_invalidOwner(t *testing.T) {
302316
}
303317

304318
func TestActionsService_DownloadArtifact_invalidRepo(t *testing.T) {
319+
t.Parallel()
305320
client, _, _ := setup(t)
306321

307322
ctx := context.Background()
@@ -310,6 +325,7 @@ func TestActionsService_DownloadArtifact_invalidRepo(t *testing.T) {
310325
}
311326

312327
func TestActionsService_DownloadArtifact_StatusMovedPermanently_dontFollowRedirects(t *testing.T) {
328+
t.Parallel()
313329
client, mux, _ := setup(t)
314330

315331
mux.HandleFunc("/repos/o/r/actions/artifacts/1/zip", func(w http.ResponseWriter, r *http.Request) {
@@ -325,6 +341,7 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_dontFollowRedire
325341
}
326342

327343
func TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects(t *testing.T) {
344+
t.Parallel()
328345
client, mux, serverURL := setup(t)
329346

330347
mux.HandleFunc("/repos/o/r/actions/artifacts/1/zip", func(w http.ResponseWriter, r *http.Request) {
@@ -352,6 +369,7 @@ func TestActionsService_DownloadArtifact_StatusMovedPermanently_followRedirects(
352369
}
353370

354371
func TestActionsService_DeleteArtifact(t *testing.T) {
372+
t.Parallel()
355373
client, mux, _ := setup(t)
356374

357375
mux.HandleFunc("/repos/o/r/actions/artifacts/1", func(w http.ResponseWriter, r *http.Request) {
@@ -376,6 +394,7 @@ func TestActionsService_DeleteArtifact(t *testing.T) {
376394
}
377395

378396
func TestActionsService_DeleteArtifact_invalidOwner(t *testing.T) {
397+
t.Parallel()
379398
client, _, _ := setup(t)
380399

381400
ctx := context.Background()
@@ -384,6 +403,7 @@ func TestActionsService_DeleteArtifact_invalidOwner(t *testing.T) {
384403
}
385404

386405
func TestActionsService_DeleteArtifact_invalidRepo(t *testing.T) {
406+
t.Parallel()
387407
client, _, _ := setup(t)
388408

389409
ctx := context.Background()
@@ -392,6 +412,7 @@ func TestActionsService_DeleteArtifact_invalidRepo(t *testing.T) {
392412
}
393413

394414
func TestActionsService_DeleteArtifact_notFound(t *testing.T) {
415+
t.Parallel()
395416
client, mux, _ := setup(t)
396417

397418
mux.HandleFunc("/repos/o/r/actions/artifacts/1", func(w http.ResponseWriter, r *http.Request) {
@@ -410,6 +431,7 @@ func TestActionsService_DeleteArtifact_notFound(t *testing.T) {
410431
}
411432

412433
func TestArtifact_Marshal(t *testing.T) {
434+
t.Parallel()
413435
testJSONMarshal(t, &Artifact{}, "{}")
414436

415437
u := &Artifact{
@@ -456,6 +478,7 @@ func TestArtifact_Marshal(t *testing.T) {
456478
}
457479

458480
func TestArtifactList_Marshal(t *testing.T) {
481+
t.Parallel()
459482
testJSONMarshal(t, &ArtifactList{}, "{}")
460483

461484
u := &ArtifactList{

0 commit comments

Comments
 (0)