From 495080fc802404cb8828e853d7b01573fccf4a99 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 11 Dec 2014 01:13:47 +0000 Subject: [PATCH] update tests because of dockerclient last update Signed-off-by: Victor Vieux --- cluster/cluster_test.go | 3 ++- cluster/node_test.go | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cluster/cluster_test.go b/cluster/cluster_test.go index 03cf2c1fcf..ded7efd709 100644 --- a/cluster/cluster_test.go +++ b/cluster/cluster_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/samalba/dockerclient" + "github.com/samalba/dockerclient/mockclient" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -13,7 +14,7 @@ func createNode(t *testing.T, ID string) *Node { assert.False(t, node.IsConnected()) - client := dockerclient.NewMockClient() + client := mockclient.NewMockClient() client.On("Info").Return(mockInfo, nil) client.On("ListContainers", true, false, "").Return([]dockerclient.Container{}, nil) client.On("StartMonitorEvents", mock.Anything, mock.Anything).Return() diff --git a/cluster/node_test.go b/cluster/node_test.go index e6009f7e1c..334eff594f 100644 --- a/cluster/node_test.go +++ b/cluster/node_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/samalba/dockerclient" + "github.com/samalba/dockerclient/mockclient" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) @@ -29,7 +30,7 @@ func TestNodeConnectionFailure(t *testing.T) { assert.False(t, node.IsConnected()) // Always fail. - client := dockerclient.NewMockClient() + client := mockclient.NewMockClient() client.On("Info").Return(&dockerclient.Info{}, errors.New("fail")) // Connect() should fail and IsConnected() return false. @@ -41,7 +42,7 @@ func TestNodeConnectionFailure(t *testing.T) { func TestOutdatedNode(t *testing.T) { node := NewNode("test") - client := dockerclient.NewMockClient() + client := mockclient.NewMockClient() client.On("Info").Return(&dockerclient.Info{}, nil) assert.Error(t, node.connectClient(client)) @@ -54,7 +55,7 @@ func TestNodeCpusMemory(t *testing.T) { node := NewNode("test") assert.False(t, node.IsConnected()) - client := dockerclient.NewMockClient() + client := mockclient.NewMockClient() client.On("Info").Return(mockInfo, nil) client.On("ListContainers", true, false, "").Return([]dockerclient.Container{}, nil) client.On("StartMonitorEvents", mock.Anything, mock.Anything).Return() @@ -73,7 +74,7 @@ func TestNodeSpecs(t *testing.T) { node := NewNode("test") assert.False(t, node.IsConnected()) - client := dockerclient.NewMockClient() + client := mockclient.NewMockClient() client.On("Info").Return(mockInfo, nil) client.On("ListContainers", true, false, "").Return([]dockerclient.Container{}, nil) client.On("StartMonitorEvents", mock.Anything, mock.Anything).Return() @@ -97,7 +98,7 @@ func TestNodeState(t *testing.T) { node := NewNode("test") assert.False(t, node.IsConnected()) - client := dockerclient.NewMockClient() + client := mockclient.NewMockClient() client.On("Info").Return(mockInfo, nil) client.On("StartMonitorEvents", mock.Anything, mock.Anything).Return()