Skip to content

Commit

Permalink
Merge branch 'main' into v1
Browse files Browse the repository at this point in the history
* main:
  chore: test cleanups (#2608)
  • Loading branch information
mdelapenya committed Jun 28, 2024
2 parents 35d9c98 + 865a70e commit cdaec16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 1 addition & 3 deletions image/build.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package image

import (
"bytes"
"context"
"errors"
"io"
Expand Down Expand Up @@ -71,8 +70,7 @@ func Build(ctx context.Context, img BuildInfo) (string, error) {

// need to read the response from Docker, I think otherwise the image
// might not finish building before continuing to execute here
buf := new(bytes.Buffer)
_, err = buf.ReadFrom(resp.Body)
_, err = io.Copy(io.Discard, resp.Body)
if err != nil {
return "", err
}
Expand Down
13 changes: 8 additions & 5 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,14 @@ func TestWithLogConsumers(t *testing.T) {
c, err := testcontainers.Run(context.Background(), req)
// we expect an error because the MySQL environment variables are not set
// but this is expected because we just want to test the log consumer
require.Error(t, err)
defer func() {
err = c.Terminate(context.Background())
require.NoError(t, err)
}()
require.EqualError(t, err, "failed to start container: container exited with code 1")
// c might be not nil even on error
if c != nil {
defer func() {
err = c.Terminate(context.Background())
require.NoError(t, err)
}()
}

assert.NotEmpty(t, lc1.msgs)
assert.NotEmpty(t, lc2.msgs)
Expand Down

0 comments on commit cdaec16

Please sign in to comment.