Skip to content

Commit 768e949

Browse files
authored
[test] Fix loop closures (#17109)
1 parent e7b89d6 commit 768e949

File tree

8 files changed

+10
-0
lines changed

8 files changed

+10
-0
lines changed

test/tests/components/ws-manager/additional_repositories_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestAdditionalRepositories(t *testing.T) {
4242
}
4343

4444
for _, test := range tests {
45+
test := test
4546
t.Run(test.Name, func(t *testing.T) {
4647
t.Parallel()
4748

test/tests/components/ws-manager/content_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func TestBackup(t *testing.T) {
5757
*/
5858
}
5959
for _, test := range tests {
60+
test := test
6061
t.Run(test.Name, func(t *testing.T) {
6162
t.Parallel()
6263

@@ -406,6 +407,7 @@ func TestMissingBackup(t *testing.T) {
406407
// {Name: "pvc", FF: []wsmanapi.WorkspaceFeatureFlag{wsmanapi.WorkspaceFeatureFlag_PERSISTENT_VOLUME_CLAIM}},
407408
}
408409
for _, test := range tests {
410+
test := test
409411
t.Run(test.Name+"_backup_init", func(t *testing.T) {
410412
t.Parallel()
411413

test/tests/components/ws-manager/prebuild_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func TestPrebuildWorkspaceTaskSuccess(t *testing.T) {
6565
*/
6666
}
6767
for _, test := range tests {
68+
test := test
6869
t.Run(test.Name, func(t *testing.T) {
6970
t.Parallel()
7071

@@ -540,6 +541,7 @@ func TestOpenWorkspaceFromOutdatedPrebuild(t *testing.T) {
540541
}
541542

542543
for _, test := range tests {
544+
test := test
543545
t.Run(test.Name, func(t *testing.T) {
544546
t.Parallel()
545547

test/tests/components/ws-manager/tasks_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func TestRegularWorkspaceTasks(t *testing.T) {
5959
WithLabel("type", "tasks").
6060
Assess("it can run workspace tasks", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
6161
for _, test := range tests {
62+
test := test
6263
t.Run(test.Name, func(t *testing.T) {
6364
t.Parallel()
6465

test/tests/workspace/contexts_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ func runContextTests(t *testing.T, tests []ContextTest) {
145145

146146
for _, ff := range ffs {
147147
for _, test := range tests {
148+
test := test
148149
t.Run(test.ContextURL+"_"+ff.Name, func(t *testing.T) {
149150
report.SetupReport(t, report.FeatureContentInit, fmt.Sprintf("Test to open %v", test.ContextURL))
150151
if test.Skip {

test/tests/workspace/example_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ func TestWorkspaceInstrumentation(t *testing.T) {
3838
WithLabel("component", "server").
3939
Assess("it can instrument a workspace", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
4040
for _, test := range tests {
41+
test := test
4142
t.Run(test.ContextURL, func(t *testing.T) {
4243
report.SetupReport(t, report.FeatureExample, "this is the example test for instrumenting a workspace")
4344

test/tests/workspace/git_hooks_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func TestGitHooks(t *testing.T) {
7373

7474
for _, ff := range ffs {
7575
for _, test := range tests {
76+
test := test
7677
t.Run(test.ContextURL+"_"+ff.Name, func(t *testing.T) {
7778
t.Parallel()
7879

test/tests/workspace/git_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func TestGitActions(t *testing.T) {
141141

142142
for _, ff := range ffs {
143143
for _, test := range tests {
144+
test := test
144145
t.Run(test.ContextURL+"_"+ff.Name, func(t *testing.T) {
145146
t.Parallel()
146147
if test.Skip {

0 commit comments

Comments
 (0)