Skip to content

Commit

Permalink
Negotiate Docker API version before attempting to create node volumes…
Browse files Browse the repository at this point in the history
… in tests. (#840)

* Negotiate Docker API version before attempting to create node volumes in tests.

* fully implement DockerClient in mock
  • Loading branch information
jbarrick-mesosphere committed Sep 19, 2019
1 parent 190c86f commit 29b2048
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/test/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ func (h *Harness) addNodeCaches(kindCfg *kindConfig.Cluster) error {
return err
}

// Determine the correct API version to use with the user's Docker client.
dockerClient.NegotiateAPIVersion(context.TODO())

// add a default node if there are none specified.
if len(kindCfg.Nodes) == 0 {
kindCfg.Nodes = append(kindCfg.Nodes, kindConfig.Node{})
Expand Down
2 changes: 2 additions & 0 deletions pkg/test/harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ func (d *dockerMock) VolumeCreate(ctx context.Context, body volumetypes.VolumeCr
}, nil
}

func (d *dockerMock) NegotiateAPIVersion(ctx context.Context) {}

func TestAddNodeCaches(t *testing.T) {
h := Harness{
T: t,
Expand Down
1 change: 1 addition & 0 deletions pkg/test/utils/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ import (

// DockerClient is a wrapper interface for the Docker library to support unit testing.
type DockerClient interface {
NegotiateAPIVersion(context.Context)
VolumeCreate(context.Context, volumetypes.VolumeCreateBody) (dockertypes.Volume, error)
}

0 comments on commit 29b2048

Please sign in to comment.