Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
yhlee-aws committed Dec 26, 2018
1 parent d53aaff commit 700ad87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions agent/dockerclient/dockerapi/docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ func (dg *dockerGoClient) loadImage(ctx context.Context, reader io.Reader) error

// flushing response reader
if resp.Body != nil {
defer resp.Body.Close()
_, err = io.Copy(ioutil.Discard, resp.Body)
}
return err
Expand Down
5 changes: 4 additions & 1 deletion agent/dockerclient/dockerapi/docker_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"encoding/base64"
"errors"
"io"
"io/ioutil"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -1057,7 +1058,9 @@ func TestLoadImageHappyPath(t *testing.T) {
mockDockerSDK, client, _, _, _, done := dockerClientSetup(t)
defer done()

mockDockerSDK.EXPECT().ImageLoad(gomock.Any(), gomock.Any(), false).Return(types.ImageLoadResponse{}, nil)
mockDockerSDK.EXPECT().ImageLoad(gomock.Any(), gomock.Any(), false).Return(types.ImageLoadResponse{
Body: ioutil.NopCloser(strings.NewReader("dummy load message")),
}, nil)

ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
Expand Down

0 comments on commit 700ad87

Please sign in to comment.