Skip to content

Commit 0368d98

Browse files
[test-parallel] Add t.Parallel() to safe codemod test files (batch after codemod_factory_test.go) (#53887)
1 parent 894c977 commit 0368d98

6 files changed

Lines changed: 92 additions & 0 deletions

pkg/cli/codemod_github_app_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ func hasDeprecatedAppFieldInContent(content string) bool {
2323
}
2424

2525
func TestGitHubAppCodemod(t *testing.T) {
26+
t.Parallel()
27+
2628
codemod := getGitHubAppCodemod()
2729

2830
t.Run("renames app to github-app under tools.github", func(t *testing.T) {
31+
t.Parallel()
32+
2933
content := `---
3034
engine: copilot
3135
tools:
@@ -59,6 +63,8 @@ tools:
5963
})
6064

6165
t.Run("renames app to github-app under safe-outputs", func(t *testing.T) {
66+
t.Parallel()
67+
6268
content := `---
6369
engine: copilot
6470
safe-outputs:
@@ -89,6 +95,8 @@ safe-outputs:
8995
})
9096

9197
t.Run("renames app to github-app under checkout", func(t *testing.T) {
98+
t.Parallel()
99+
92100
content := `---
93101
engine: copilot
94102
checkout:
@@ -117,6 +125,8 @@ checkout:
117125
})
118126

119127
t.Run("renames top-level app to github-app", func(t *testing.T) {
128+
t.Parallel()
129+
120130
content := `---
121131
engine: copilot
122132
app:
@@ -142,6 +152,8 @@ app:
142152
})
143153

144154
t.Run("does not modify workflows without app field", func(t *testing.T) {
155+
t.Parallel()
156+
145157
content := `---
146158
engine: copilot
147159
tools:
@@ -169,6 +181,8 @@ tools:
169181
})
170182

171183
t.Run("does not modify app field outside target sections", func(t *testing.T) {
184+
t.Parallel()
185+
172186
content := `---
173187
engine: copilot
174188
tools:
@@ -194,6 +208,8 @@ tools:
194208
})
195209

196210
t.Run("renames app in all three sections", func(t *testing.T) {
211+
t.Parallel()
212+
197213
content := `---
198214
engine: copilot
199215
tools:
@@ -239,6 +255,8 @@ safe-outputs:
239255
})
240256

241257
t.Run("does not rename already migrated github-app field", func(t *testing.T) {
258+
t.Parallel()
259+
242260
content := `---
243261
engine: copilot
244262
tools:
@@ -271,6 +289,8 @@ tools:
271289
})
272290

273291
t.Run("renames app to github-app inside checkout array item", func(t *testing.T) {
292+
t.Parallel()
293+
274294
content := `---
275295
engine: copilot
276296
checkout:
@@ -303,6 +323,8 @@ checkout:
303323
})
304324

305325
t.Run("preserves comments and formatting", func(t *testing.T) {
326+
t.Parallel()
327+
306328
content := `---
307329
engine: copilot
308330
tools:
@@ -337,6 +359,8 @@ tools:
337359
})
338360

339361
t.Run("renames top-level app and nested app in the same document", func(t *testing.T) {
362+
t.Parallel()
363+
340364
content := `---
341365
engine: copilot
342366
app:

pkg/cli/codemod_github_repos_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import (
1010
)
1111

1212
func TestGitHubReposToAllowedReposCodemod(t *testing.T) {
13+
t.Parallel()
14+
1315
codemod := getGitHubReposToAllowedReposCodemod()
1416

1517
t.Run("renames repos to allowed-repos under tools.github", func(t *testing.T) {
18+
t.Parallel()
19+
1620
content := `---
1721
engine: copilot
1822
tools:
@@ -45,6 +49,8 @@ tools:
4549
})
4650

4751
t.Run("renames repos array to allowed-repos under tools.github", func(t *testing.T) {
52+
t.Parallel()
53+
4854
content := `---
4955
engine: copilot
5056
tools:
@@ -77,6 +83,8 @@ tools:
7783
})
7884

7985
t.Run("does not modify workflows without repos field", func(t *testing.T) {
86+
t.Parallel()
87+
8088
content := `---
8189
engine: copilot
8290
tools:
@@ -102,6 +110,8 @@ tools:
102110
})
103111

104112
t.Run("does not modify workflows without tools.github section", func(t *testing.T) {
113+
t.Parallel()
114+
105115
content := `---
106116
engine: copilot
107117
---
@@ -119,6 +129,8 @@ engine: copilot
119129
})
120130

121131
t.Run("does not rename already-migrated allowed-repos field", func(t *testing.T) {
132+
t.Parallel()
133+
122134
content := `---
123135
engine: copilot
124136
tools:
@@ -148,6 +160,8 @@ tools:
148160
})
149161

150162
t.Run("does not rename repos when allowed-repos already present", func(t *testing.T) {
163+
t.Parallel()
164+
151165
content := `---
152166
engine: copilot
153167
tools:
@@ -179,6 +193,8 @@ tools:
179193
})
180194

181195
t.Run("does not rename repos in toolsets list", func(t *testing.T) {
196+
t.Parallel()
197+
182198
content := `---
183199
engine: copilot
184200
tools:
@@ -210,6 +226,8 @@ tools:
210226
})
211227

212228
t.Run("does not rename repos in comments", func(t *testing.T) {
229+
t.Parallel()
230+
213231
content := `---
214232
engine: copilot
215233
tools:

pkg/cli/codemod_inline_agents_test.go

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

1313
func TestInlineAgentsFeatureRemovalCodemod(t *testing.T) {
14+
t.Parallel()
15+
1416
codemod := getInlineAgentsFeatureRemovalCodemod()
1517
assert.Equal(t, "1.0.0", codemod.IntroducedIn)
1618

@@ -54,6 +56,8 @@ features:
5456

5557
for _, tt := range tests {
5658
t.Run(tt.name, func(t *testing.T) {
59+
t.Parallel()
60+
5761
result, err := parser.ExtractFrontmatterFromContent(tt.input)
5862
require.NoError(t, err, "Failed to parse test input frontmatter")
5963

pkg/cli/codemod_mount_as_clis_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import (
1010
)
1111

1212
func TestMountAsCLIsToCLIProxyCodemod(t *testing.T) {
13+
t.Parallel()
14+
1315
codemod := getMountAsCLIsToCLIProxyCodemod()
1416

1517
t.Run("renames tools.mount-as-clis to tools.cli-proxy", func(t *testing.T) {
18+
t.Parallel()
19+
1620
content := `---
1721
tools:
1822
mount-as-clis: true
@@ -38,6 +42,8 @@ tools:
3842
})
3943

4044
t.Run("removes features.mcp-cli flag", func(t *testing.T) {
45+
t.Parallel()
46+
4147
content := `---
4248
features:
4349
mcp-cli: true
@@ -59,6 +65,8 @@ features:
5965
})
6066

6167
t.Run("renames mount-as-clis and removes mcp-cli together", func(t *testing.T) {
68+
t.Parallel()
69+
6270
content := `---
6371
tools:
6472
mount-as-clis: true
@@ -89,6 +97,8 @@ features:
8997
})
9098

9199
t.Run("does not apply when neither key present", func(t *testing.T) {
100+
t.Parallel()
101+
92102
content := `---
93103
tools:
94104
cli-proxy: true
@@ -109,6 +119,8 @@ tools:
109119
})
110120

111121
t.Run("does not rename mount-as-clis outside tools block", func(t *testing.T) {
122+
t.Parallel()
123+
112124
content := `---
113125
tools:
114126
playwright: true
@@ -133,6 +145,8 @@ steps:
133145
})
134146

135147
t.Run("preserves false value when renaming", func(t *testing.T) {
148+
t.Parallel()
149+
136150
content := `---
137151
tools:
138152
mount-as-clis: false

pkg/cli/codemod_pull_request_target_checkout_false_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import (
1010
)
1111

1212
func TestPullRequestTargetCheckoutFalseCodemod(t *testing.T) {
13+
t.Parallel()
14+
1315
codemod := getPullRequestTargetCheckoutFalseCodemod()
1416

1517
t.Run("adds checkout false after on block when missing", func(t *testing.T) {
18+
t.Parallel()
19+
1620
content := `---
1721
on:
1822
pull_request_target:
@@ -35,6 +39,8 @@ description: Review PR metadata
3539
})
3640

3741
t.Run("normalizes checkout true to false", func(t *testing.T) {
42+
t.Parallel()
43+
3844
content := `---
3945
on:
4046
pull_request_target:
@@ -56,6 +62,8 @@ checkout: true
5662
})
5763

5864
t.Run("preserves inline comment spacing when normalizing checkout", func(t *testing.T) {
65+
t.Parallel()
66+
5967
content := `---
6068
on:
6169
pull_request_target:
@@ -77,6 +85,8 @@ checkout: true # keep-comment
7785
})
7886

7987
t.Run("does not modify when checkout false already exists", func(t *testing.T) {
88+
t.Parallel()
89+
8090
content := `---
8191
on:
8292
pull_request_target:
@@ -97,6 +107,8 @@ checkout: false
97107
})
98108

99109
t.Run("does not modify non pull_request_target workflow", func(t *testing.T) {
110+
t.Parallel()
111+
100112
content := `---
101113
on:
102114
pull_request:
@@ -115,6 +127,8 @@ on:
115127
})
116128

117129
t.Run("does not modify when explicit checkout command exists", func(t *testing.T) {
130+
t.Parallel()
131+
118132
content := `---
119133
on:
120134
pull_request_target:
@@ -135,6 +149,8 @@ Run gh pr checkout ${{ github.event.pull_request.number }} before tests.
135149
})
136150

137151
t.Run("does not modify when git checkout uses tab separator", func(t *testing.T) {
152+
t.Parallel()
153+
138154
content := "---\non:\n pull_request_target:\n---\n\nUse git checkout\tfeature-branch before tests.\n"
139155
frontmatter := map[string]any{
140156
"on": map[string]any{
@@ -149,6 +165,8 @@ Run gh pr checkout ${{ github.event.pull_request.number }} before tests.
149165
})
150166

151167
t.Run("does not modify when strict is explicitly false", func(t *testing.T) {
168+
t.Parallel()
169+
152170
content := `---
153171
on:
154172
pull_request_target:
@@ -169,6 +187,8 @@ strict: false
169187
})
170188

171189
t.Run("does not modify when checkout is a mapping with sub-keys", func(t *testing.T) {
190+
t.Parallel()
191+
172192
content := `---
173193
description: "Review Azure SDK management-plane PRs"
174194
on:

pkg/cli/codemod_safe_output_add_reviewer_allowlists_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import (
1010
)
1111

1212
func TestSafeOutputAddReviewerAllowlistsCodemod(t *testing.T) {
13+
t.Parallel()
14+
1315
codemod := getSafeOutputAddReviewerAllowlistsCodemod()
1416

1517
t.Run("renames reviewers and team-reviewers to allowed-reviewers and allowed-team-reviewers", func(t *testing.T) {
18+
t.Parallel()
19+
1620
content := `---
1721
safe-outputs:
1822
add-reviewer:
@@ -41,6 +45,8 @@ safe-outputs:
4145
})
4246

4347
t.Run("renames only reviewers when team-reviewers absent", func(t *testing.T) {
48+
t.Parallel()
49+
4450
content := `---
4551
safe-outputs:
4652
add-reviewer:
@@ -63,6 +69,8 @@ safe-outputs:
6369
})
6470

6571
t.Run("does not modify when new fields already present", func(t *testing.T) {
72+
t.Parallel()
73+
6674
content := `---
6775
safe-outputs:
6876
add-reviewer:
@@ -86,6 +94,8 @@ safe-outputs:
8694
})
8795

8896
t.Run("does not affect create-pull-request reviewers", func(t *testing.T) {
97+
t.Parallel()
98+
8999
content := `---
90100
safe-outputs:
91101
create-pull-request:
@@ -115,6 +125,8 @@ safe-outputs:
115125
})
116126

117127
t.Run("no-op when safe-outputs missing", func(t *testing.T) {
128+
t.Parallel()
129+
118130
content := `---
119131
engine: copilot
120132
---

0 commit comments

Comments
 (0)