Skip to content

Commit ef2560d

Browse files
committed
oci: fix loop iterator aliasing
Signed-off-by: Akihiro Suda <[email protected]>
1 parent 676b942 commit ef2560d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

oci/spec_opts_linux_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ guest:x:405:100:guest:/dev/null:/sbin/nologin
7070
},
7171
}
7272
for _, testCase := range testCases {
73+
testCase := testCase
7374
t.Run(fmt.Sprintf("user %d", testCase.userID), func(t *testing.T) {
7475
t.Parallel()
7576
s := Spec{
@@ -129,6 +130,7 @@ guest:x:405:100:guest:/dev/null:/sbin/nologin
129130
},
130131
}
131132
for _, testCase := range testCases {
133+
testCase := testCase
132134
t.Run(testCase.user, func(t *testing.T) {
133135
t.Parallel()
134136
s := Spec{
@@ -178,11 +180,11 @@ sys:x:3:root,bin,adm
178180
}{
179181
{
180182
user: "root",
181-
expected: []uint32{},
183+
expected: []uint32{1, 2, 3},
182184
},
183185
{
184186
user: "1000",
185-
expected: []uint32{},
187+
expected: nil,
186188
},
187189
{
188190
user: "bin",
@@ -198,6 +200,7 @@ sys:x:3:root,bin,adm
198200
},
199201
}
200202
for _, testCase := range testCases {
203+
testCase := testCase
201204
t.Run(testCase.user, func(t *testing.T) {
202205
t.Parallel()
203206
s := Spec{
@@ -490,6 +493,7 @@ daemon:x:2:root,bin,daemon
490493
}
491494

492495
for _, testCase := range testCases {
496+
testCase := testCase
493497
t.Run(testCase.name, func(t *testing.T) {
494498
t.Parallel()
495499
s := Spec{

0 commit comments

Comments
 (0)