Skip to content

Commit

Permalink
test: fix flaky TestDockerEngine (aquasecurity#6054)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen authored Feb 2, 2024
1 parent c3a66da commit 27d35ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions integration/docker_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,25 @@ func TestDockerEngine(t *testing.T) {
// load image into docker engine
res, err := cli.ImageLoad(ctx, testfile, true)
require.NoError(t, err, tt.name)
io.Copy(io.Discard, res.Body)
if _, err := io.Copy(io.Discard, res.Body); err != nil {
require.NoError(t, err, tt.name)
}
defer res.Body.Close()

// tag our image to something unique
err = cli.ImageTag(ctx, tt.imageTag, tt.input)
require.NoError(t, err, tt.name)

// cleanup
t.Cleanup(func() {
_, err = cli.ImageRemove(ctx, tt.input, api.ImageRemoveOptions{
_, _ = cli.ImageRemove(ctx, tt.input, api.ImageRemoveOptions{
Force: true,
PruneChildren: true,
})
_, err = cli.ImageRemove(ctx, tt.imageTag, api.ImageRemoveOptions{
_, _ = cli.ImageRemove(ctx, tt.imageTag, api.ImageRemoveOptions{
Force: true,
PruneChildren: true,
})
assert.NoError(t, err, tt.name)
})
}

Expand Down

0 comments on commit 27d35ba

Please sign in to comment.