Skip to content

Commit 7b0382e

Browse files
committed
Fix sync.WaitGroup usage in concurrent RemoveImage test
The test was incorrectly calling wg.Go() which doesn't exist on sync.WaitGroup. Fixed to use the proper pattern: wg.Add(1), go func(), and defer wg.Done(). Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
1 parent 3d68d48 commit 7b0382e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/validate/image_consistency.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ var _ = framework.KubeDescribe("Image Consistency", func() {
133133
results := make(chan removeResult, 5)
134134

135135
for range 5 {
136-
wg.Go(func() {
136+
wg.Add(1)
137+
go func() {
138+
defer wg.Done()
137139
// Use the specific image ID for removal to avoid ambiguity
138140
remErr := c.RemoveImage(context.Background(), &runtimeapi.ImageSpec{Image: imageID})
139141

@@ -142,7 +144,7 @@ var _ = framework.KubeDescribe("Image Consistency", func() {
142144
imageFound := (status != nil)
143145

144146
results <- removeResult{err: remErr, imageFound: imageFound}
145-
})
147+
}()
146148
}
147149
wg.Wait()
148150
close(results)

0 commit comments

Comments
 (0)