@@ -225,21 +225,17 @@ func ensureImage(ctx context.Context, t *testing.T, cli *client.Client, ref stri
225
225
t .Logf ("ensuring image %q" , ref )
226
226
images , err := cli .ImageList (ctx , image.ListOptions {})
227
227
require .NoError (t , err , "list images" )
228
- var found bool
229
228
for _ , img := range images {
230
229
if slices .Contains (img .RepoTags , ref ) {
231
230
t .Logf ("image %q found locally, not pulling" , ref )
232
- found = true
233
- break
231
+ return
234
232
}
235
233
}
236
- if ! found {
237
- t .Logf ("image %s not found locally, attempting to pull" , ref )
238
- resp , err := cli .ImagePull (ctx , ref , image.PullOptions {})
239
- require .NoError (t , err )
240
- _ , err = io .ReadAll (resp )
241
- require .NoError (t , err )
242
- }
234
+ t .Logf ("image %s not found locally, attempting to pull" , ref )
235
+ resp , err := cli .ImagePull (ctx , ref , image.PullOptions {})
236
+ require .NoError (t , err )
237
+ _ , err = io .ReadAll (resp )
238
+ require .NoError (t , err )
243
239
}
244
240
245
241
// execContainer executes the given command in the given container and returns
0 commit comments