From b8093e668aa3743f67cda62665884723674d76ec Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Wed, 10 Feb 2021 20:41:15 +0100 Subject: [PATCH 1/6] Kill Unit test mocking docker client API Signed-off-by: Guillaume Tardif --- local/compose/compose.go | 4 +- local/compose/kill_test.go | 92 ++ local/mocks/mock_docker_api.go | 1812 ++++++++++++++++++++++++++++++++ 3 files changed, 1906 insertions(+), 2 deletions(-) create mode 100644 local/compose/kill_test.go create mode 100644 local/mocks/mock_docker_api.go diff --git a/local/compose/compose.go b/local/compose/compose.go index d3af6e53..e05302f7 100644 --- a/local/compose/compose.go +++ b/local/compose/compose.go @@ -33,12 +33,12 @@ import ( ) // NewComposeService create a local implementation of the compose.Service API -func NewComposeService(apiClient *client.Client) compose.Service { +func NewComposeService(apiClient client.APIClient) compose.Service { return &composeService{apiClient: apiClient} } type composeService struct { - apiClient *client.Client + apiClient client.APIClient } func (s *composeService) Up(ctx context.Context, project *types.Project, options compose.UpOptions) error { diff --git a/local/compose/kill_test.go b/local/compose/kill_test.go new file mode 100644 index 00000000..bf03f6b0 --- /dev/null +++ b/local/compose/kill_test.go @@ -0,0 +1,92 @@ +/* + Copyright 2020 Docker Compose CLI authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package compose + +import ( + "context" + "testing" + + "github.com/compose-spec/compose-go/types" + apitypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/filters" + + "github.com/golang/mock/gomock" + "gotest.tools/v3/assert" + + "github.com/docker/compose-cli/api/compose" + "github.com/docker/compose-cli/local/mocks" +) + +var ( + s = composeService{} + projectListOpts = apitypes.ContainerListOptions{ + Filters: filters.NewArgs(projectFilter("myProject")), + All: true, + } +) + +func TestKillAll(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + api := mocks.NewMockAPIClient(mockCtrl) + s.apiClient = api + + project := types.Project{Name: "myProject", Services: []types.ServiceConfig{testService("service1"), testService("service2")}} + + ctx := context.Background() + api.EXPECT().ContainerList(ctx, projectListOpts).Return([]apitypes.Container{testContainer("service1", "123"), testContainer("service1", "456"), testContainer("service2", "789")}, nil) + api.EXPECT().ContainerKill(anyCancellableContext(), "123", "").Return(nil) + api.EXPECT().ContainerKill(anyCancellableContext(), "456", "").Return(nil) + api.EXPECT().ContainerKill(anyCancellableContext(), "789", "").Return(nil) + + err := s.Kill(ctx, &project, compose.KillOptions{}) + assert.NilError(t, err) +} + +func TestKillSignal(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + api := mocks.NewMockAPIClient(mockCtrl) + s.apiClient = api + + project := types.Project{Name: "myProject", Services: []types.ServiceConfig{testService("service1")}} + + ctx := context.Background() + api.EXPECT().ContainerList(ctx, projectListOpts).Return([]apitypes.Container{testContainer("service1", "123")}, nil) + api.EXPECT().ContainerKill(anyCancellableContext(), "123", "SIGTERM").Return(nil) + + err := s.Kill(ctx, &project, compose.KillOptions{Signal: "SIGTERM"}) + assert.NilError(t, err) +} + +func testService(name string) types.ServiceConfig { + return types.ServiceConfig{Name: name} +} + +func testContainer(service string, id string) apitypes.Container { + return apitypes.Container{ + ID: id, + Names: []string{id}, + Labels: map[string]string{compose.ServiceTag: service}, + } +} + +func anyCancellableContext() gomock.Matcher { + ctxWithCancel, cancel := context.WithCancel(context.Background()) + cancel() + return gomock.AssignableToTypeOf(ctxWithCancel) +} diff --git a/local/mocks/mock_docker_api.go b/local/mocks/mock_docker_api.go new file mode 100644 index 00000000..f7ff8f4b --- /dev/null +++ b/local/mocks/mock_docker_api.go @@ -0,0 +1,1812 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/docker/docker/client (interfaces: APIClient) + +// Package mocks is a generated GoMock package. +package mocks + +import ( + context "context" + types "github.com/docker/docker/api/types" + container "github.com/docker/docker/api/types/container" + events "github.com/docker/docker/api/types/events" + filters "github.com/docker/docker/api/types/filters" + image "github.com/docker/docker/api/types/image" + network "github.com/docker/docker/api/types/network" + registry "github.com/docker/docker/api/types/registry" + swarm "github.com/docker/docker/api/types/swarm" + volume "github.com/docker/docker/api/types/volume" + gomock "github.com/golang/mock/gomock" + v1 "github.com/opencontainers/image-spec/specs-go/v1" + io "io" + net "net" + http "net/http" + reflect "reflect" + time "time" +) + +// MockAPIClient is a mock of APIClient interface +type MockAPIClient struct { + ctrl *gomock.Controller + recorder *MockAPIClientMockRecorder +} + +// MockAPIClientMockRecorder is the mock recorder for MockAPIClient +type MockAPIClientMockRecorder struct { + mock *MockAPIClient +} + +// NewMockAPIClient creates a new mock instance +func NewMockAPIClient(ctrl *gomock.Controller) *MockAPIClient { + mock := &MockAPIClient{ctrl: ctrl} + mock.recorder = &MockAPIClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockAPIClient) EXPECT() *MockAPIClientMockRecorder { + return m.recorder +} + +// BuildCachePrune mocks base method +func (m *MockAPIClient) BuildCachePrune(arg0 context.Context, arg1 types.BuildCachePruneOptions) (*types.BuildCachePruneReport, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BuildCachePrune", arg0, arg1) + ret0, _ := ret[0].(*types.BuildCachePruneReport) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// BuildCachePrune indicates an expected call of BuildCachePrune +func (mr *MockAPIClientMockRecorder) BuildCachePrune(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildCachePrune", reflect.TypeOf((*MockAPIClient)(nil).BuildCachePrune), arg0, arg1) +} + +// BuildCancel mocks base method +func (m *MockAPIClient) BuildCancel(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BuildCancel", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// BuildCancel indicates an expected call of BuildCancel +func (mr *MockAPIClientMockRecorder) BuildCancel(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildCancel", reflect.TypeOf((*MockAPIClient)(nil).BuildCancel), arg0, arg1) +} + +// CheckpointCreate mocks base method +func (m *MockAPIClient) CheckpointCreate(arg0 context.Context, arg1 string, arg2 types.CheckpointCreateOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckpointCreate", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckpointCreate indicates an expected call of CheckpointCreate +func (mr *MockAPIClientMockRecorder) CheckpointCreate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckpointCreate", reflect.TypeOf((*MockAPIClient)(nil).CheckpointCreate), arg0, arg1, arg2) +} + +// CheckpointDelete mocks base method +func (m *MockAPIClient) CheckpointDelete(arg0 context.Context, arg1 string, arg2 types.CheckpointDeleteOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckpointDelete", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckpointDelete indicates an expected call of CheckpointDelete +func (mr *MockAPIClientMockRecorder) CheckpointDelete(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckpointDelete", reflect.TypeOf((*MockAPIClient)(nil).CheckpointDelete), arg0, arg1, arg2) +} + +// CheckpointList mocks base method +func (m *MockAPIClient) CheckpointList(arg0 context.Context, arg1 string, arg2 types.CheckpointListOptions) ([]types.Checkpoint, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckpointList", arg0, arg1, arg2) + ret0, _ := ret[0].([]types.Checkpoint) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CheckpointList indicates an expected call of CheckpointList +func (mr *MockAPIClientMockRecorder) CheckpointList(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckpointList", reflect.TypeOf((*MockAPIClient)(nil).CheckpointList), arg0, arg1, arg2) +} + +// ClientVersion mocks base method +func (m *MockAPIClient) ClientVersion() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ClientVersion") + ret0, _ := ret[0].(string) + return ret0 +} + +// ClientVersion indicates an expected call of ClientVersion +func (mr *MockAPIClientMockRecorder) ClientVersion() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClientVersion", reflect.TypeOf((*MockAPIClient)(nil).ClientVersion)) +} + +// Close mocks base method +func (m *MockAPIClient) Close() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close") + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close +func (mr *MockAPIClientMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAPIClient)(nil).Close)) +} + +// ConfigCreate mocks base method +func (m *MockAPIClient) ConfigCreate(arg0 context.Context, arg1 swarm.ConfigSpec) (types.ConfigCreateResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfigCreate", arg0, arg1) + ret0, _ := ret[0].(types.ConfigCreateResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ConfigCreate indicates an expected call of ConfigCreate +func (mr *MockAPIClientMockRecorder) ConfigCreate(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfigCreate", reflect.TypeOf((*MockAPIClient)(nil).ConfigCreate), arg0, arg1) +} + +// ConfigInspectWithRaw mocks base method +func (m *MockAPIClient) ConfigInspectWithRaw(arg0 context.Context, arg1 string) (swarm.Config, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfigInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(swarm.Config) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ConfigInspectWithRaw indicates an expected call of ConfigInspectWithRaw +func (mr *MockAPIClientMockRecorder) ConfigInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfigInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).ConfigInspectWithRaw), arg0, arg1) +} + +// ConfigList mocks base method +func (m *MockAPIClient) ConfigList(arg0 context.Context, arg1 types.ConfigListOptions) ([]swarm.Config, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfigList", arg0, arg1) + ret0, _ := ret[0].([]swarm.Config) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ConfigList indicates an expected call of ConfigList +func (mr *MockAPIClientMockRecorder) ConfigList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfigList", reflect.TypeOf((*MockAPIClient)(nil).ConfigList), arg0, arg1) +} + +// ConfigRemove mocks base method +func (m *MockAPIClient) ConfigRemove(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfigRemove", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ConfigRemove indicates an expected call of ConfigRemove +func (mr *MockAPIClientMockRecorder) ConfigRemove(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfigRemove", reflect.TypeOf((*MockAPIClient)(nil).ConfigRemove), arg0, arg1) +} + +// ConfigUpdate mocks base method +func (m *MockAPIClient) ConfigUpdate(arg0 context.Context, arg1 string, arg2 swarm.Version, arg3 swarm.ConfigSpec) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ConfigUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// ConfigUpdate indicates an expected call of ConfigUpdate +func (mr *MockAPIClientMockRecorder) ConfigUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConfigUpdate", reflect.TypeOf((*MockAPIClient)(nil).ConfigUpdate), arg0, arg1, arg2, arg3) +} + +// ContainerAttach mocks base method +func (m *MockAPIClient) ContainerAttach(arg0 context.Context, arg1 string, arg2 types.ContainerAttachOptions) (types.HijackedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerAttach", arg0, arg1, arg2) + ret0, _ := ret[0].(types.HijackedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerAttach indicates an expected call of ContainerAttach +func (mr *MockAPIClientMockRecorder) ContainerAttach(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerAttach", reflect.TypeOf((*MockAPIClient)(nil).ContainerAttach), arg0, arg1, arg2) +} + +// ContainerCommit mocks base method +func (m *MockAPIClient) ContainerCommit(arg0 context.Context, arg1 string, arg2 types.ContainerCommitOptions) (types.IDResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerCommit", arg0, arg1, arg2) + ret0, _ := ret[0].(types.IDResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerCommit indicates an expected call of ContainerCommit +func (mr *MockAPIClientMockRecorder) ContainerCommit(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerCommit", reflect.TypeOf((*MockAPIClient)(nil).ContainerCommit), arg0, arg1, arg2) +} + +// ContainerCreate mocks base method +func (m *MockAPIClient) ContainerCreate(arg0 context.Context, arg1 *container.Config, arg2 *container.HostConfig, arg3 *network.NetworkingConfig, arg4 *v1.Platform, arg5 string) (container.ContainerCreateCreatedBody, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerCreate", arg0, arg1, arg2, arg3, arg4, arg5) + ret0, _ := ret[0].(container.ContainerCreateCreatedBody) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerCreate indicates an expected call of ContainerCreate +func (mr *MockAPIClientMockRecorder) ContainerCreate(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerCreate", reflect.TypeOf((*MockAPIClient)(nil).ContainerCreate), arg0, arg1, arg2, arg3, arg4, arg5) +} + +// ContainerDiff mocks base method +func (m *MockAPIClient) ContainerDiff(arg0 context.Context, arg1 string) ([]container.ContainerChangeResponseItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerDiff", arg0, arg1) + ret0, _ := ret[0].([]container.ContainerChangeResponseItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerDiff indicates an expected call of ContainerDiff +func (mr *MockAPIClientMockRecorder) ContainerDiff(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerDiff", reflect.TypeOf((*MockAPIClient)(nil).ContainerDiff), arg0, arg1) +} + +// ContainerExecAttach mocks base method +func (m *MockAPIClient) ContainerExecAttach(arg0 context.Context, arg1 string, arg2 types.ExecStartCheck) (types.HijackedResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerExecAttach", arg0, arg1, arg2) + ret0, _ := ret[0].(types.HijackedResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerExecAttach indicates an expected call of ContainerExecAttach +func (mr *MockAPIClientMockRecorder) ContainerExecAttach(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerExecAttach", reflect.TypeOf((*MockAPIClient)(nil).ContainerExecAttach), arg0, arg1, arg2) +} + +// ContainerExecCreate mocks base method +func (m *MockAPIClient) ContainerExecCreate(arg0 context.Context, arg1 string, arg2 types.ExecConfig) (types.IDResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerExecCreate", arg0, arg1, arg2) + ret0, _ := ret[0].(types.IDResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerExecCreate indicates an expected call of ContainerExecCreate +func (mr *MockAPIClientMockRecorder) ContainerExecCreate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerExecCreate", reflect.TypeOf((*MockAPIClient)(nil).ContainerExecCreate), arg0, arg1, arg2) +} + +// ContainerExecInspect mocks base method +func (m *MockAPIClient) ContainerExecInspect(arg0 context.Context, arg1 string) (types.ContainerExecInspect, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerExecInspect", arg0, arg1) + ret0, _ := ret[0].(types.ContainerExecInspect) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerExecInspect indicates an expected call of ContainerExecInspect +func (mr *MockAPIClientMockRecorder) ContainerExecInspect(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerExecInspect", reflect.TypeOf((*MockAPIClient)(nil).ContainerExecInspect), arg0, arg1) +} + +// ContainerExecResize mocks base method +func (m *MockAPIClient) ContainerExecResize(arg0 context.Context, arg1 string, arg2 types.ResizeOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerExecResize", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerExecResize indicates an expected call of ContainerExecResize +func (mr *MockAPIClientMockRecorder) ContainerExecResize(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerExecResize", reflect.TypeOf((*MockAPIClient)(nil).ContainerExecResize), arg0, arg1, arg2) +} + +// ContainerExecStart mocks base method +func (m *MockAPIClient) ContainerExecStart(arg0 context.Context, arg1 string, arg2 types.ExecStartCheck) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerExecStart", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerExecStart indicates an expected call of ContainerExecStart +func (mr *MockAPIClientMockRecorder) ContainerExecStart(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerExecStart", reflect.TypeOf((*MockAPIClient)(nil).ContainerExecStart), arg0, arg1, arg2) +} + +// ContainerExport mocks base method +func (m *MockAPIClient) ContainerExport(arg0 context.Context, arg1 string) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerExport", arg0, arg1) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerExport indicates an expected call of ContainerExport +func (mr *MockAPIClientMockRecorder) ContainerExport(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerExport", reflect.TypeOf((*MockAPIClient)(nil).ContainerExport), arg0, arg1) +} + +// ContainerInspect mocks base method +func (m *MockAPIClient) ContainerInspect(arg0 context.Context, arg1 string) (types.ContainerJSON, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerInspect", arg0, arg1) + ret0, _ := ret[0].(types.ContainerJSON) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerInspect indicates an expected call of ContainerInspect +func (mr *MockAPIClientMockRecorder) ContainerInspect(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerInspect", reflect.TypeOf((*MockAPIClient)(nil).ContainerInspect), arg0, arg1) +} + +// ContainerInspectWithRaw mocks base method +func (m *MockAPIClient) ContainerInspectWithRaw(arg0 context.Context, arg1 string, arg2 bool) (types.ContainerJSON, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerInspectWithRaw", arg0, arg1, arg2) + ret0, _ := ret[0].(types.ContainerJSON) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ContainerInspectWithRaw indicates an expected call of ContainerInspectWithRaw +func (mr *MockAPIClientMockRecorder) ContainerInspectWithRaw(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).ContainerInspectWithRaw), arg0, arg1, arg2) +} + +// ContainerKill mocks base method +func (m *MockAPIClient) ContainerKill(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerKill", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerKill indicates an expected call of ContainerKill +func (mr *MockAPIClientMockRecorder) ContainerKill(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerKill", reflect.TypeOf((*MockAPIClient)(nil).ContainerKill), arg0, arg1, arg2) +} + +// ContainerList mocks base method +func (m *MockAPIClient) ContainerList(arg0 context.Context, arg1 types.ContainerListOptions) ([]types.Container, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerList", arg0, arg1) + ret0, _ := ret[0].([]types.Container) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerList indicates an expected call of ContainerList +func (mr *MockAPIClientMockRecorder) ContainerList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerList", reflect.TypeOf((*MockAPIClient)(nil).ContainerList), arg0, arg1) +} + +// ContainerLogs mocks base method +func (m *MockAPIClient) ContainerLogs(arg0 context.Context, arg1 string, arg2 types.ContainerLogsOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerLogs", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerLogs indicates an expected call of ContainerLogs +func (mr *MockAPIClientMockRecorder) ContainerLogs(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerLogs", reflect.TypeOf((*MockAPIClient)(nil).ContainerLogs), arg0, arg1, arg2) +} + +// ContainerPause mocks base method +func (m *MockAPIClient) ContainerPause(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerPause", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerPause indicates an expected call of ContainerPause +func (mr *MockAPIClientMockRecorder) ContainerPause(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerPause", reflect.TypeOf((*MockAPIClient)(nil).ContainerPause), arg0, arg1) +} + +// ContainerRemove mocks base method +func (m *MockAPIClient) ContainerRemove(arg0 context.Context, arg1 string, arg2 types.ContainerRemoveOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerRemove", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerRemove indicates an expected call of ContainerRemove +func (mr *MockAPIClientMockRecorder) ContainerRemove(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerRemove", reflect.TypeOf((*MockAPIClient)(nil).ContainerRemove), arg0, arg1, arg2) +} + +// ContainerRename mocks base method +func (m *MockAPIClient) ContainerRename(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerRename", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerRename indicates an expected call of ContainerRename +func (mr *MockAPIClientMockRecorder) ContainerRename(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerRename", reflect.TypeOf((*MockAPIClient)(nil).ContainerRename), arg0, arg1, arg2) +} + +// ContainerResize mocks base method +func (m *MockAPIClient) ContainerResize(arg0 context.Context, arg1 string, arg2 types.ResizeOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerResize", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerResize indicates an expected call of ContainerResize +func (mr *MockAPIClientMockRecorder) ContainerResize(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerResize", reflect.TypeOf((*MockAPIClient)(nil).ContainerResize), arg0, arg1, arg2) +} + +// ContainerRestart mocks base method +func (m *MockAPIClient) ContainerRestart(arg0 context.Context, arg1 string, arg2 *time.Duration) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerRestart", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerRestart indicates an expected call of ContainerRestart +func (mr *MockAPIClientMockRecorder) ContainerRestart(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerRestart", reflect.TypeOf((*MockAPIClient)(nil).ContainerRestart), arg0, arg1, arg2) +} + +// ContainerStart mocks base method +func (m *MockAPIClient) ContainerStart(arg0 context.Context, arg1 string, arg2 types.ContainerStartOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerStart", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerStart indicates an expected call of ContainerStart +func (mr *MockAPIClientMockRecorder) ContainerStart(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerStart", reflect.TypeOf((*MockAPIClient)(nil).ContainerStart), arg0, arg1, arg2) +} + +// ContainerStatPath mocks base method +func (m *MockAPIClient) ContainerStatPath(arg0 context.Context, arg1, arg2 string) (types.ContainerPathStat, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerStatPath", arg0, arg1, arg2) + ret0, _ := ret[0].(types.ContainerPathStat) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerStatPath indicates an expected call of ContainerStatPath +func (mr *MockAPIClientMockRecorder) ContainerStatPath(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerStatPath", reflect.TypeOf((*MockAPIClient)(nil).ContainerStatPath), arg0, arg1, arg2) +} + +// ContainerStats mocks base method +func (m *MockAPIClient) ContainerStats(arg0 context.Context, arg1 string, arg2 bool) (types.ContainerStats, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerStats", arg0, arg1, arg2) + ret0, _ := ret[0].(types.ContainerStats) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerStats indicates an expected call of ContainerStats +func (mr *MockAPIClientMockRecorder) ContainerStats(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerStats", reflect.TypeOf((*MockAPIClient)(nil).ContainerStats), arg0, arg1, arg2) +} + +// ContainerStatsOneShot mocks base method +func (m *MockAPIClient) ContainerStatsOneShot(arg0 context.Context, arg1 string) (types.ContainerStats, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerStatsOneShot", arg0, arg1) + ret0, _ := ret[0].(types.ContainerStats) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerStatsOneShot indicates an expected call of ContainerStatsOneShot +func (mr *MockAPIClientMockRecorder) ContainerStatsOneShot(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerStatsOneShot", reflect.TypeOf((*MockAPIClient)(nil).ContainerStatsOneShot), arg0, arg1) +} + +// ContainerStop mocks base method +func (m *MockAPIClient) ContainerStop(arg0 context.Context, arg1 string, arg2 *time.Duration) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerStop", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerStop indicates an expected call of ContainerStop +func (mr *MockAPIClientMockRecorder) ContainerStop(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerStop", reflect.TypeOf((*MockAPIClient)(nil).ContainerStop), arg0, arg1, arg2) +} + +// ContainerTop mocks base method +func (m *MockAPIClient) ContainerTop(arg0 context.Context, arg1 string, arg2 []string) (container.ContainerTopOKBody, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerTop", arg0, arg1, arg2) + ret0, _ := ret[0].(container.ContainerTopOKBody) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerTop indicates an expected call of ContainerTop +func (mr *MockAPIClientMockRecorder) ContainerTop(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerTop", reflect.TypeOf((*MockAPIClient)(nil).ContainerTop), arg0, arg1, arg2) +} + +// ContainerUnpause mocks base method +func (m *MockAPIClient) ContainerUnpause(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerUnpause", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ContainerUnpause indicates an expected call of ContainerUnpause +func (mr *MockAPIClientMockRecorder) ContainerUnpause(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerUnpause", reflect.TypeOf((*MockAPIClient)(nil).ContainerUnpause), arg0, arg1) +} + +// ContainerUpdate mocks base method +func (m *MockAPIClient) ContainerUpdate(arg0 context.Context, arg1 string, arg2 container.UpdateConfig) (container.ContainerUpdateOKBody, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerUpdate", arg0, arg1, arg2) + ret0, _ := ret[0].(container.ContainerUpdateOKBody) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainerUpdate indicates an expected call of ContainerUpdate +func (mr *MockAPIClientMockRecorder) ContainerUpdate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerUpdate", reflect.TypeOf((*MockAPIClient)(nil).ContainerUpdate), arg0, arg1, arg2) +} + +// ContainerWait mocks base method +func (m *MockAPIClient) ContainerWait(arg0 context.Context, arg1 string, arg2 container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainerWait", arg0, arg1, arg2) + ret0, _ := ret[0].(<-chan container.ContainerWaitOKBody) + ret1, _ := ret[1].(<-chan error) + return ret0, ret1 +} + +// ContainerWait indicates an expected call of ContainerWait +func (mr *MockAPIClientMockRecorder) ContainerWait(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerWait", reflect.TypeOf((*MockAPIClient)(nil).ContainerWait), arg0, arg1, arg2) +} + +// ContainersPrune mocks base method +func (m *MockAPIClient) ContainersPrune(arg0 context.Context, arg1 filters.Args) (types.ContainersPruneReport, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ContainersPrune", arg0, arg1) + ret0, _ := ret[0].(types.ContainersPruneReport) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ContainersPrune indicates an expected call of ContainersPrune +func (mr *MockAPIClientMockRecorder) ContainersPrune(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainersPrune", reflect.TypeOf((*MockAPIClient)(nil).ContainersPrune), arg0, arg1) +} + +// CopyFromContainer mocks base method +func (m *MockAPIClient) CopyFromContainer(arg0 context.Context, arg1, arg2 string) (io.ReadCloser, types.ContainerPathStat, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CopyFromContainer", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(types.ContainerPathStat) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// CopyFromContainer indicates an expected call of CopyFromContainer +func (mr *MockAPIClientMockRecorder) CopyFromContainer(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CopyFromContainer", reflect.TypeOf((*MockAPIClient)(nil).CopyFromContainer), arg0, arg1, arg2) +} + +// CopyToContainer mocks base method +func (m *MockAPIClient) CopyToContainer(arg0 context.Context, arg1, arg2 string, arg3 io.Reader, arg4 types.CopyToContainerOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CopyToContainer", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(error) + return ret0 +} + +// CopyToContainer indicates an expected call of CopyToContainer +func (mr *MockAPIClientMockRecorder) CopyToContainer(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CopyToContainer", reflect.TypeOf((*MockAPIClient)(nil).CopyToContainer), arg0, arg1, arg2, arg3, arg4) +} + +// DaemonHost mocks base method +func (m *MockAPIClient) DaemonHost() string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DaemonHost") + ret0, _ := ret[0].(string) + return ret0 +} + +// DaemonHost indicates an expected call of DaemonHost +func (mr *MockAPIClientMockRecorder) DaemonHost() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DaemonHost", reflect.TypeOf((*MockAPIClient)(nil).DaemonHost)) +} + +// DialHijack mocks base method +func (m *MockAPIClient) DialHijack(arg0 context.Context, arg1, arg2 string, arg3 map[string][]string) (net.Conn, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DialHijack", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(net.Conn) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DialHijack indicates an expected call of DialHijack +func (mr *MockAPIClientMockRecorder) DialHijack(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DialHijack", reflect.TypeOf((*MockAPIClient)(nil).DialHijack), arg0, arg1, arg2, arg3) +} + +// Dialer mocks base method +func (m *MockAPIClient) Dialer() func(context.Context) (net.Conn, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Dialer") + ret0, _ := ret[0].(func(context.Context) (net.Conn, error)) + return ret0 +} + +// Dialer indicates an expected call of Dialer +func (mr *MockAPIClientMockRecorder) Dialer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dialer", reflect.TypeOf((*MockAPIClient)(nil).Dialer)) +} + +// DiskUsage mocks base method +func (m *MockAPIClient) DiskUsage(arg0 context.Context) (types.DiskUsage, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DiskUsage", arg0) + ret0, _ := ret[0].(types.DiskUsage) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DiskUsage indicates an expected call of DiskUsage +func (mr *MockAPIClientMockRecorder) DiskUsage(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DiskUsage", reflect.TypeOf((*MockAPIClient)(nil).DiskUsage), arg0) +} + +// DistributionInspect mocks base method +func (m *MockAPIClient) DistributionInspect(arg0 context.Context, arg1, arg2 string) (registry.DistributionInspect, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DistributionInspect", arg0, arg1, arg2) + ret0, _ := ret[0].(registry.DistributionInspect) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DistributionInspect indicates an expected call of DistributionInspect +func (mr *MockAPIClientMockRecorder) DistributionInspect(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DistributionInspect", reflect.TypeOf((*MockAPIClient)(nil).DistributionInspect), arg0, arg1, arg2) +} + +// Events mocks base method +func (m *MockAPIClient) Events(arg0 context.Context, arg1 types.EventsOptions) (<-chan events.Message, <-chan error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Events", arg0, arg1) + ret0, _ := ret[0].(<-chan events.Message) + ret1, _ := ret[1].(<-chan error) + return ret0, ret1 +} + +// Events indicates an expected call of Events +func (mr *MockAPIClientMockRecorder) Events(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Events", reflect.TypeOf((*MockAPIClient)(nil).Events), arg0, arg1) +} + +// HTTPClient mocks base method +func (m *MockAPIClient) HTTPClient() *http.Client { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HTTPClient") + ret0, _ := ret[0].(*http.Client) + return ret0 +} + +// HTTPClient indicates an expected call of HTTPClient +func (mr *MockAPIClientMockRecorder) HTTPClient() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HTTPClient", reflect.TypeOf((*MockAPIClient)(nil).HTTPClient)) +} + +// ImageBuild mocks base method +func (m *MockAPIClient) ImageBuild(arg0 context.Context, arg1 io.Reader, arg2 types.ImageBuildOptions) (types.ImageBuildResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageBuild", arg0, arg1, arg2) + ret0, _ := ret[0].(types.ImageBuildResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageBuild indicates an expected call of ImageBuild +func (mr *MockAPIClientMockRecorder) ImageBuild(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageBuild", reflect.TypeOf((*MockAPIClient)(nil).ImageBuild), arg0, arg1, arg2) +} + +// ImageCreate mocks base method +func (m *MockAPIClient) ImageCreate(arg0 context.Context, arg1 string, arg2 types.ImageCreateOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageCreate", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageCreate indicates an expected call of ImageCreate +func (mr *MockAPIClientMockRecorder) ImageCreate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageCreate", reflect.TypeOf((*MockAPIClient)(nil).ImageCreate), arg0, arg1, arg2) +} + +// ImageHistory mocks base method +func (m *MockAPIClient) ImageHistory(arg0 context.Context, arg1 string) ([]image.HistoryResponseItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageHistory", arg0, arg1) + ret0, _ := ret[0].([]image.HistoryResponseItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageHistory indicates an expected call of ImageHistory +func (mr *MockAPIClientMockRecorder) ImageHistory(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageHistory", reflect.TypeOf((*MockAPIClient)(nil).ImageHistory), arg0, arg1) +} + +// ImageImport mocks base method +func (m *MockAPIClient) ImageImport(arg0 context.Context, arg1 types.ImageImportSource, arg2 string, arg3 types.ImageImportOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageImport", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageImport indicates an expected call of ImageImport +func (mr *MockAPIClientMockRecorder) ImageImport(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageImport", reflect.TypeOf((*MockAPIClient)(nil).ImageImport), arg0, arg1, arg2, arg3) +} + +// ImageInspectWithRaw mocks base method +func (m *MockAPIClient) ImageInspectWithRaw(arg0 context.Context, arg1 string) (types.ImageInspect, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(types.ImageInspect) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ImageInspectWithRaw indicates an expected call of ImageInspectWithRaw +func (mr *MockAPIClientMockRecorder) ImageInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).ImageInspectWithRaw), arg0, arg1) +} + +// ImageList mocks base method +func (m *MockAPIClient) ImageList(arg0 context.Context, arg1 types.ImageListOptions) ([]types.ImageSummary, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageList", arg0, arg1) + ret0, _ := ret[0].([]types.ImageSummary) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageList indicates an expected call of ImageList +func (mr *MockAPIClientMockRecorder) ImageList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageList", reflect.TypeOf((*MockAPIClient)(nil).ImageList), arg0, arg1) +} + +// ImageLoad mocks base method +func (m *MockAPIClient) ImageLoad(arg0 context.Context, arg1 io.Reader, arg2 bool) (types.ImageLoadResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageLoad", arg0, arg1, arg2) + ret0, _ := ret[0].(types.ImageLoadResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageLoad indicates an expected call of ImageLoad +func (mr *MockAPIClientMockRecorder) ImageLoad(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageLoad", reflect.TypeOf((*MockAPIClient)(nil).ImageLoad), arg0, arg1, arg2) +} + +// ImagePull mocks base method +func (m *MockAPIClient) ImagePull(arg0 context.Context, arg1 string, arg2 types.ImagePullOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImagePull", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImagePull indicates an expected call of ImagePull +func (mr *MockAPIClientMockRecorder) ImagePull(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImagePull", reflect.TypeOf((*MockAPIClient)(nil).ImagePull), arg0, arg1, arg2) +} + +// ImagePush mocks base method +func (m *MockAPIClient) ImagePush(arg0 context.Context, arg1 string, arg2 types.ImagePushOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImagePush", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImagePush indicates an expected call of ImagePush +func (mr *MockAPIClientMockRecorder) ImagePush(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImagePush", reflect.TypeOf((*MockAPIClient)(nil).ImagePush), arg0, arg1, arg2) +} + +// ImageRemove mocks base method +func (m *MockAPIClient) ImageRemove(arg0 context.Context, arg1 string, arg2 types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageRemove", arg0, arg1, arg2) + ret0, _ := ret[0].([]types.ImageDeleteResponseItem) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageRemove indicates an expected call of ImageRemove +func (mr *MockAPIClientMockRecorder) ImageRemove(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageRemove", reflect.TypeOf((*MockAPIClient)(nil).ImageRemove), arg0, arg1, arg2) +} + +// ImageSave mocks base method +func (m *MockAPIClient) ImageSave(arg0 context.Context, arg1 []string) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageSave", arg0, arg1) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageSave indicates an expected call of ImageSave +func (mr *MockAPIClientMockRecorder) ImageSave(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageSave", reflect.TypeOf((*MockAPIClient)(nil).ImageSave), arg0, arg1) +} + +// ImageSearch mocks base method +func (m *MockAPIClient) ImageSearch(arg0 context.Context, arg1 string, arg2 types.ImageSearchOptions) ([]registry.SearchResult, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageSearch", arg0, arg1, arg2) + ret0, _ := ret[0].([]registry.SearchResult) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImageSearch indicates an expected call of ImageSearch +func (mr *MockAPIClientMockRecorder) ImageSearch(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageSearch", reflect.TypeOf((*MockAPIClient)(nil).ImageSearch), arg0, arg1, arg2) +} + +// ImageTag mocks base method +func (m *MockAPIClient) ImageTag(arg0 context.Context, arg1, arg2 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImageTag", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// ImageTag indicates an expected call of ImageTag +func (mr *MockAPIClientMockRecorder) ImageTag(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageTag", reflect.TypeOf((*MockAPIClient)(nil).ImageTag), arg0, arg1, arg2) +} + +// ImagesPrune mocks base method +func (m *MockAPIClient) ImagesPrune(arg0 context.Context, arg1 filters.Args) (types.ImagesPruneReport, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ImagesPrune", arg0, arg1) + ret0, _ := ret[0].(types.ImagesPruneReport) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ImagesPrune indicates an expected call of ImagesPrune +func (mr *MockAPIClientMockRecorder) ImagesPrune(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImagesPrune", reflect.TypeOf((*MockAPIClient)(nil).ImagesPrune), arg0, arg1) +} + +// Info mocks base method +func (m *MockAPIClient) Info(arg0 context.Context) (types.Info, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Info", arg0) + ret0, _ := ret[0].(types.Info) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Info indicates an expected call of Info +func (mr *MockAPIClientMockRecorder) Info(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info", reflect.TypeOf((*MockAPIClient)(nil).Info), arg0) +} + +// NegotiateAPIVersion mocks base method +func (m *MockAPIClient) NegotiateAPIVersion(arg0 context.Context) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "NegotiateAPIVersion", arg0) +} + +// NegotiateAPIVersion indicates an expected call of NegotiateAPIVersion +func (mr *MockAPIClientMockRecorder) NegotiateAPIVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NegotiateAPIVersion", reflect.TypeOf((*MockAPIClient)(nil).NegotiateAPIVersion), arg0) +} + +// NegotiateAPIVersionPing mocks base method +func (m *MockAPIClient) NegotiateAPIVersionPing(arg0 types.Ping) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "NegotiateAPIVersionPing", arg0) +} + +// NegotiateAPIVersionPing indicates an expected call of NegotiateAPIVersionPing +func (mr *MockAPIClientMockRecorder) NegotiateAPIVersionPing(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NegotiateAPIVersionPing", reflect.TypeOf((*MockAPIClient)(nil).NegotiateAPIVersionPing), arg0) +} + +// NetworkConnect mocks base method +func (m *MockAPIClient) NetworkConnect(arg0 context.Context, arg1, arg2 string, arg3 *network.EndpointSettings) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkConnect", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// NetworkConnect indicates an expected call of NetworkConnect +func (mr *MockAPIClientMockRecorder) NetworkConnect(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkConnect", reflect.TypeOf((*MockAPIClient)(nil).NetworkConnect), arg0, arg1, arg2, arg3) +} + +// NetworkCreate mocks base method +func (m *MockAPIClient) NetworkCreate(arg0 context.Context, arg1 string, arg2 types.NetworkCreate) (types.NetworkCreateResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkCreate", arg0, arg1, arg2) + ret0, _ := ret[0].(types.NetworkCreateResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NetworkCreate indicates an expected call of NetworkCreate +func (mr *MockAPIClientMockRecorder) NetworkCreate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkCreate", reflect.TypeOf((*MockAPIClient)(nil).NetworkCreate), arg0, arg1, arg2) +} + +// NetworkDisconnect mocks base method +func (m *MockAPIClient) NetworkDisconnect(arg0 context.Context, arg1, arg2 string, arg3 bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkDisconnect", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// NetworkDisconnect indicates an expected call of NetworkDisconnect +func (mr *MockAPIClientMockRecorder) NetworkDisconnect(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkDisconnect", reflect.TypeOf((*MockAPIClient)(nil).NetworkDisconnect), arg0, arg1, arg2, arg3) +} + +// NetworkInspect mocks base method +func (m *MockAPIClient) NetworkInspect(arg0 context.Context, arg1 string, arg2 types.NetworkInspectOptions) (types.NetworkResource, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkInspect", arg0, arg1, arg2) + ret0, _ := ret[0].(types.NetworkResource) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NetworkInspect indicates an expected call of NetworkInspect +func (mr *MockAPIClientMockRecorder) NetworkInspect(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInspect", reflect.TypeOf((*MockAPIClient)(nil).NetworkInspect), arg0, arg1, arg2) +} + +// NetworkInspectWithRaw mocks base method +func (m *MockAPIClient) NetworkInspectWithRaw(arg0 context.Context, arg1 string, arg2 types.NetworkInspectOptions) (types.NetworkResource, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkInspectWithRaw", arg0, arg1, arg2) + ret0, _ := ret[0].(types.NetworkResource) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// NetworkInspectWithRaw indicates an expected call of NetworkInspectWithRaw +func (mr *MockAPIClientMockRecorder) NetworkInspectWithRaw(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).NetworkInspectWithRaw), arg0, arg1, arg2) +} + +// NetworkList mocks base method +func (m *MockAPIClient) NetworkList(arg0 context.Context, arg1 types.NetworkListOptions) ([]types.NetworkResource, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkList", arg0, arg1) + ret0, _ := ret[0].([]types.NetworkResource) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NetworkList indicates an expected call of NetworkList +func (mr *MockAPIClientMockRecorder) NetworkList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkList", reflect.TypeOf((*MockAPIClient)(nil).NetworkList), arg0, arg1) +} + +// NetworkRemove mocks base method +func (m *MockAPIClient) NetworkRemove(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworkRemove", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// NetworkRemove indicates an expected call of NetworkRemove +func (mr *MockAPIClientMockRecorder) NetworkRemove(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkRemove", reflect.TypeOf((*MockAPIClient)(nil).NetworkRemove), arg0, arg1) +} + +// NetworksPrune mocks base method +func (m *MockAPIClient) NetworksPrune(arg0 context.Context, arg1 filters.Args) (types.NetworksPruneReport, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NetworksPrune", arg0, arg1) + ret0, _ := ret[0].(types.NetworksPruneReport) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NetworksPrune indicates an expected call of NetworksPrune +func (mr *MockAPIClientMockRecorder) NetworksPrune(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworksPrune", reflect.TypeOf((*MockAPIClient)(nil).NetworksPrune), arg0, arg1) +} + +// NodeInspectWithRaw mocks base method +func (m *MockAPIClient) NodeInspectWithRaw(arg0 context.Context, arg1 string) (swarm.Node, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NodeInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(swarm.Node) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// NodeInspectWithRaw indicates an expected call of NodeInspectWithRaw +func (mr *MockAPIClientMockRecorder) NodeInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).NodeInspectWithRaw), arg0, arg1) +} + +// NodeList mocks base method +func (m *MockAPIClient) NodeList(arg0 context.Context, arg1 types.NodeListOptions) ([]swarm.Node, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NodeList", arg0, arg1) + ret0, _ := ret[0].([]swarm.Node) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NodeList indicates an expected call of NodeList +func (mr *MockAPIClientMockRecorder) NodeList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeList", reflect.TypeOf((*MockAPIClient)(nil).NodeList), arg0, arg1) +} + +// NodeRemove mocks base method +func (m *MockAPIClient) NodeRemove(arg0 context.Context, arg1 string, arg2 types.NodeRemoveOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NodeRemove", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// NodeRemove indicates an expected call of NodeRemove +func (mr *MockAPIClientMockRecorder) NodeRemove(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeRemove", reflect.TypeOf((*MockAPIClient)(nil).NodeRemove), arg0, arg1, arg2) +} + +// NodeUpdate mocks base method +func (m *MockAPIClient) NodeUpdate(arg0 context.Context, arg1 string, arg2 swarm.Version, arg3 swarm.NodeSpec) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NodeUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// NodeUpdate indicates an expected call of NodeUpdate +func (mr *MockAPIClientMockRecorder) NodeUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NodeUpdate", reflect.TypeOf((*MockAPIClient)(nil).NodeUpdate), arg0, arg1, arg2, arg3) +} + +// Ping mocks base method +func (m *MockAPIClient) Ping(arg0 context.Context) (types.Ping, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Ping", arg0) + ret0, _ := ret[0].(types.Ping) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Ping indicates an expected call of Ping +func (mr *MockAPIClientMockRecorder) Ping(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*MockAPIClient)(nil).Ping), arg0) +} + +// PluginCreate mocks base method +func (m *MockAPIClient) PluginCreate(arg0 context.Context, arg1 io.Reader, arg2 types.PluginCreateOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginCreate", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// PluginCreate indicates an expected call of PluginCreate +func (mr *MockAPIClientMockRecorder) PluginCreate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginCreate", reflect.TypeOf((*MockAPIClient)(nil).PluginCreate), arg0, arg1, arg2) +} + +// PluginDisable mocks base method +func (m *MockAPIClient) PluginDisable(arg0 context.Context, arg1 string, arg2 types.PluginDisableOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginDisable", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// PluginDisable indicates an expected call of PluginDisable +func (mr *MockAPIClientMockRecorder) PluginDisable(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginDisable", reflect.TypeOf((*MockAPIClient)(nil).PluginDisable), arg0, arg1, arg2) +} + +// PluginEnable mocks base method +func (m *MockAPIClient) PluginEnable(arg0 context.Context, arg1 string, arg2 types.PluginEnableOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginEnable", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// PluginEnable indicates an expected call of PluginEnable +func (mr *MockAPIClientMockRecorder) PluginEnable(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginEnable", reflect.TypeOf((*MockAPIClient)(nil).PluginEnable), arg0, arg1, arg2) +} + +// PluginInspectWithRaw mocks base method +func (m *MockAPIClient) PluginInspectWithRaw(arg0 context.Context, arg1 string) (*types.Plugin, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(*types.Plugin) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// PluginInspectWithRaw indicates an expected call of PluginInspectWithRaw +func (mr *MockAPIClientMockRecorder) PluginInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).PluginInspectWithRaw), arg0, arg1) +} + +// PluginInstall mocks base method +func (m *MockAPIClient) PluginInstall(arg0 context.Context, arg1 string, arg2 types.PluginInstallOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginInstall", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PluginInstall indicates an expected call of PluginInstall +func (mr *MockAPIClientMockRecorder) PluginInstall(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginInstall", reflect.TypeOf((*MockAPIClient)(nil).PluginInstall), arg0, arg1, arg2) +} + +// PluginList mocks base method +func (m *MockAPIClient) PluginList(arg0 context.Context, arg1 filters.Args) (types.PluginsListResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginList", arg0, arg1) + ret0, _ := ret[0].(types.PluginsListResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PluginList indicates an expected call of PluginList +func (mr *MockAPIClientMockRecorder) PluginList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginList", reflect.TypeOf((*MockAPIClient)(nil).PluginList), arg0, arg1) +} + +// PluginPush mocks base method +func (m *MockAPIClient) PluginPush(arg0 context.Context, arg1, arg2 string) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginPush", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PluginPush indicates an expected call of PluginPush +func (mr *MockAPIClientMockRecorder) PluginPush(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginPush", reflect.TypeOf((*MockAPIClient)(nil).PluginPush), arg0, arg1, arg2) +} + +// PluginRemove mocks base method +func (m *MockAPIClient) PluginRemove(arg0 context.Context, arg1 string, arg2 types.PluginRemoveOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginRemove", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// PluginRemove indicates an expected call of PluginRemove +func (mr *MockAPIClientMockRecorder) PluginRemove(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginRemove", reflect.TypeOf((*MockAPIClient)(nil).PluginRemove), arg0, arg1, arg2) +} + +// PluginSet mocks base method +func (m *MockAPIClient) PluginSet(arg0 context.Context, arg1 string, arg2 []string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginSet", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// PluginSet indicates an expected call of PluginSet +func (mr *MockAPIClientMockRecorder) PluginSet(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginSet", reflect.TypeOf((*MockAPIClient)(nil).PluginSet), arg0, arg1, arg2) +} + +// PluginUpgrade mocks base method +func (m *MockAPIClient) PluginUpgrade(arg0 context.Context, arg1 string, arg2 types.PluginInstallOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PluginUpgrade", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// PluginUpgrade indicates an expected call of PluginUpgrade +func (mr *MockAPIClientMockRecorder) PluginUpgrade(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PluginUpgrade", reflect.TypeOf((*MockAPIClient)(nil).PluginUpgrade), arg0, arg1, arg2) +} + +// RegistryLogin mocks base method +func (m *MockAPIClient) RegistryLogin(arg0 context.Context, arg1 types.AuthConfig) (registry.AuthenticateOKBody, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RegistryLogin", arg0, arg1) + ret0, _ := ret[0].(registry.AuthenticateOKBody) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RegistryLogin indicates an expected call of RegistryLogin +func (mr *MockAPIClientMockRecorder) RegistryLogin(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegistryLogin", reflect.TypeOf((*MockAPIClient)(nil).RegistryLogin), arg0, arg1) +} + +// SecretCreate mocks base method +func (m *MockAPIClient) SecretCreate(arg0 context.Context, arg1 swarm.SecretSpec) (types.SecretCreateResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SecretCreate", arg0, arg1) + ret0, _ := ret[0].(types.SecretCreateResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SecretCreate indicates an expected call of SecretCreate +func (mr *MockAPIClientMockRecorder) SecretCreate(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SecretCreate", reflect.TypeOf((*MockAPIClient)(nil).SecretCreate), arg0, arg1) +} + +// SecretInspectWithRaw mocks base method +func (m *MockAPIClient) SecretInspectWithRaw(arg0 context.Context, arg1 string) (swarm.Secret, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SecretInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(swarm.Secret) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// SecretInspectWithRaw indicates an expected call of SecretInspectWithRaw +func (mr *MockAPIClientMockRecorder) SecretInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SecretInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).SecretInspectWithRaw), arg0, arg1) +} + +// SecretList mocks base method +func (m *MockAPIClient) SecretList(arg0 context.Context, arg1 types.SecretListOptions) ([]swarm.Secret, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SecretList", arg0, arg1) + ret0, _ := ret[0].([]swarm.Secret) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SecretList indicates an expected call of SecretList +func (mr *MockAPIClientMockRecorder) SecretList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SecretList", reflect.TypeOf((*MockAPIClient)(nil).SecretList), arg0, arg1) +} + +// SecretRemove mocks base method +func (m *MockAPIClient) SecretRemove(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SecretRemove", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SecretRemove indicates an expected call of SecretRemove +func (mr *MockAPIClientMockRecorder) SecretRemove(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SecretRemove", reflect.TypeOf((*MockAPIClient)(nil).SecretRemove), arg0, arg1) +} + +// SecretUpdate mocks base method +func (m *MockAPIClient) SecretUpdate(arg0 context.Context, arg1 string, arg2 swarm.Version, arg3 swarm.SecretSpec) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SecretUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// SecretUpdate indicates an expected call of SecretUpdate +func (mr *MockAPIClientMockRecorder) SecretUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SecretUpdate", reflect.TypeOf((*MockAPIClient)(nil).SecretUpdate), arg0, arg1, arg2, arg3) +} + +// ServerVersion mocks base method +func (m *MockAPIClient) ServerVersion(arg0 context.Context) (types.Version, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServerVersion", arg0) + ret0, _ := ret[0].(types.Version) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ServerVersion indicates an expected call of ServerVersion +func (mr *MockAPIClientMockRecorder) ServerVersion(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServerVersion", reflect.TypeOf((*MockAPIClient)(nil).ServerVersion), arg0) +} + +// ServiceCreate mocks base method +func (m *MockAPIClient) ServiceCreate(arg0 context.Context, arg1 swarm.ServiceSpec, arg2 types.ServiceCreateOptions) (types.ServiceCreateResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServiceCreate", arg0, arg1, arg2) + ret0, _ := ret[0].(types.ServiceCreateResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ServiceCreate indicates an expected call of ServiceCreate +func (mr *MockAPIClientMockRecorder) ServiceCreate(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceCreate", reflect.TypeOf((*MockAPIClient)(nil).ServiceCreate), arg0, arg1, arg2) +} + +// ServiceInspectWithRaw mocks base method +func (m *MockAPIClient) ServiceInspectWithRaw(arg0 context.Context, arg1 string, arg2 types.ServiceInspectOptions) (swarm.Service, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServiceInspectWithRaw", arg0, arg1, arg2) + ret0, _ := ret[0].(swarm.Service) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// ServiceInspectWithRaw indicates an expected call of ServiceInspectWithRaw +func (mr *MockAPIClientMockRecorder) ServiceInspectWithRaw(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).ServiceInspectWithRaw), arg0, arg1, arg2) +} + +// ServiceList mocks base method +func (m *MockAPIClient) ServiceList(arg0 context.Context, arg1 types.ServiceListOptions) ([]swarm.Service, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServiceList", arg0, arg1) + ret0, _ := ret[0].([]swarm.Service) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ServiceList indicates an expected call of ServiceList +func (mr *MockAPIClientMockRecorder) ServiceList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceList", reflect.TypeOf((*MockAPIClient)(nil).ServiceList), arg0, arg1) +} + +// ServiceLogs mocks base method +func (m *MockAPIClient) ServiceLogs(arg0 context.Context, arg1 string, arg2 types.ContainerLogsOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServiceLogs", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ServiceLogs indicates an expected call of ServiceLogs +func (mr *MockAPIClientMockRecorder) ServiceLogs(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceLogs", reflect.TypeOf((*MockAPIClient)(nil).ServiceLogs), arg0, arg1, arg2) +} + +// ServiceRemove mocks base method +func (m *MockAPIClient) ServiceRemove(arg0 context.Context, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServiceRemove", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// ServiceRemove indicates an expected call of ServiceRemove +func (mr *MockAPIClientMockRecorder) ServiceRemove(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceRemove", reflect.TypeOf((*MockAPIClient)(nil).ServiceRemove), arg0, arg1) +} + +// ServiceUpdate mocks base method +func (m *MockAPIClient) ServiceUpdate(arg0 context.Context, arg1 string, arg2 swarm.Version, arg3 swarm.ServiceSpec, arg4 types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ServiceUpdate", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(types.ServiceUpdateResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ServiceUpdate indicates an expected call of ServiceUpdate +func (mr *MockAPIClientMockRecorder) ServiceUpdate(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceUpdate", reflect.TypeOf((*MockAPIClient)(nil).ServiceUpdate), arg0, arg1, arg2, arg3, arg4) +} + +// SwarmGetUnlockKey mocks base method +func (m *MockAPIClient) SwarmGetUnlockKey(arg0 context.Context) (types.SwarmUnlockKeyResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmGetUnlockKey", arg0) + ret0, _ := ret[0].(types.SwarmUnlockKeyResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SwarmGetUnlockKey indicates an expected call of SwarmGetUnlockKey +func (mr *MockAPIClientMockRecorder) SwarmGetUnlockKey(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmGetUnlockKey", reflect.TypeOf((*MockAPIClient)(nil).SwarmGetUnlockKey), arg0) +} + +// SwarmInit mocks base method +func (m *MockAPIClient) SwarmInit(arg0 context.Context, arg1 swarm.InitRequest) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmInit", arg0, arg1) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SwarmInit indicates an expected call of SwarmInit +func (mr *MockAPIClientMockRecorder) SwarmInit(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmInit", reflect.TypeOf((*MockAPIClient)(nil).SwarmInit), arg0, arg1) +} + +// SwarmInspect mocks base method +func (m *MockAPIClient) SwarmInspect(arg0 context.Context) (swarm.Swarm, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmInspect", arg0) + ret0, _ := ret[0].(swarm.Swarm) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SwarmInspect indicates an expected call of SwarmInspect +func (mr *MockAPIClientMockRecorder) SwarmInspect(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmInspect", reflect.TypeOf((*MockAPIClient)(nil).SwarmInspect), arg0) +} + +// SwarmJoin mocks base method +func (m *MockAPIClient) SwarmJoin(arg0 context.Context, arg1 swarm.JoinRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmJoin", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SwarmJoin indicates an expected call of SwarmJoin +func (mr *MockAPIClientMockRecorder) SwarmJoin(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmJoin", reflect.TypeOf((*MockAPIClient)(nil).SwarmJoin), arg0, arg1) +} + +// SwarmLeave mocks base method +func (m *MockAPIClient) SwarmLeave(arg0 context.Context, arg1 bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmLeave", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SwarmLeave indicates an expected call of SwarmLeave +func (mr *MockAPIClientMockRecorder) SwarmLeave(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmLeave", reflect.TypeOf((*MockAPIClient)(nil).SwarmLeave), arg0, arg1) +} + +// SwarmUnlock mocks base method +func (m *MockAPIClient) SwarmUnlock(arg0 context.Context, arg1 swarm.UnlockRequest) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmUnlock", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SwarmUnlock indicates an expected call of SwarmUnlock +func (mr *MockAPIClientMockRecorder) SwarmUnlock(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmUnlock", reflect.TypeOf((*MockAPIClient)(nil).SwarmUnlock), arg0, arg1) +} + +// SwarmUpdate mocks base method +func (m *MockAPIClient) SwarmUpdate(arg0 context.Context, arg1 swarm.Version, arg2 swarm.Spec, arg3 swarm.UpdateFlags) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SwarmUpdate", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].(error) + return ret0 +} + +// SwarmUpdate indicates an expected call of SwarmUpdate +func (mr *MockAPIClientMockRecorder) SwarmUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SwarmUpdate", reflect.TypeOf((*MockAPIClient)(nil).SwarmUpdate), arg0, arg1, arg2, arg3) +} + +// TaskInspectWithRaw mocks base method +func (m *MockAPIClient) TaskInspectWithRaw(arg0 context.Context, arg1 string) (swarm.Task, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TaskInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(swarm.Task) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// TaskInspectWithRaw indicates an expected call of TaskInspectWithRaw +func (mr *MockAPIClientMockRecorder) TaskInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TaskInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).TaskInspectWithRaw), arg0, arg1) +} + +// TaskList mocks base method +func (m *MockAPIClient) TaskList(arg0 context.Context, arg1 types.TaskListOptions) ([]swarm.Task, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TaskList", arg0, arg1) + ret0, _ := ret[0].([]swarm.Task) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TaskList indicates an expected call of TaskList +func (mr *MockAPIClientMockRecorder) TaskList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TaskList", reflect.TypeOf((*MockAPIClient)(nil).TaskList), arg0, arg1) +} + +// TaskLogs mocks base method +func (m *MockAPIClient) TaskLogs(arg0 context.Context, arg1 string, arg2 types.ContainerLogsOptions) (io.ReadCloser, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TaskLogs", arg0, arg1, arg2) + ret0, _ := ret[0].(io.ReadCloser) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// TaskLogs indicates an expected call of TaskLogs +func (mr *MockAPIClientMockRecorder) TaskLogs(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TaskLogs", reflect.TypeOf((*MockAPIClient)(nil).TaskLogs), arg0, arg1, arg2) +} + +// VolumeCreate mocks base method +func (m *MockAPIClient) VolumeCreate(arg0 context.Context, arg1 volume.VolumeCreateBody) (types.Volume, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VolumeCreate", arg0, arg1) + ret0, _ := ret[0].(types.Volume) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VolumeCreate indicates an expected call of VolumeCreate +func (mr *MockAPIClientMockRecorder) VolumeCreate(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VolumeCreate", reflect.TypeOf((*MockAPIClient)(nil).VolumeCreate), arg0, arg1) +} + +// VolumeInspect mocks base method +func (m *MockAPIClient) VolumeInspect(arg0 context.Context, arg1 string) (types.Volume, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VolumeInspect", arg0, arg1) + ret0, _ := ret[0].(types.Volume) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VolumeInspect indicates an expected call of VolumeInspect +func (mr *MockAPIClientMockRecorder) VolumeInspect(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VolumeInspect", reflect.TypeOf((*MockAPIClient)(nil).VolumeInspect), arg0, arg1) +} + +// VolumeInspectWithRaw mocks base method +func (m *MockAPIClient) VolumeInspectWithRaw(arg0 context.Context, arg1 string) (types.Volume, []byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VolumeInspectWithRaw", arg0, arg1) + ret0, _ := ret[0].(types.Volume) + ret1, _ := ret[1].([]byte) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// VolumeInspectWithRaw indicates an expected call of VolumeInspectWithRaw +func (mr *MockAPIClientMockRecorder) VolumeInspectWithRaw(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VolumeInspectWithRaw", reflect.TypeOf((*MockAPIClient)(nil).VolumeInspectWithRaw), arg0, arg1) +} + +// VolumeList mocks base method +func (m *MockAPIClient) VolumeList(arg0 context.Context, arg1 filters.Args) (volume.VolumeListOKBody, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VolumeList", arg0, arg1) + ret0, _ := ret[0].(volume.VolumeListOKBody) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VolumeList indicates an expected call of VolumeList +func (mr *MockAPIClientMockRecorder) VolumeList(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VolumeList", reflect.TypeOf((*MockAPIClient)(nil).VolumeList), arg0, arg1) +} + +// VolumeRemove mocks base method +func (m *MockAPIClient) VolumeRemove(arg0 context.Context, arg1 string, arg2 bool) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VolumeRemove", arg0, arg1, arg2) + ret0, _ := ret[0].(error) + return ret0 +} + +// VolumeRemove indicates an expected call of VolumeRemove +func (mr *MockAPIClientMockRecorder) VolumeRemove(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VolumeRemove", reflect.TypeOf((*MockAPIClient)(nil).VolumeRemove), arg0, arg1, arg2) +} + +// VolumesPrune mocks base method +func (m *MockAPIClient) VolumesPrune(arg0 context.Context, arg1 filters.Args) (types.VolumesPruneReport, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "VolumesPrune", arg0, arg1) + ret0, _ := ret[0].(types.VolumesPruneReport) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// VolumesPrune indicates an expected call of VolumesPrune +func (mr *MockAPIClientMockRecorder) VolumesPrune(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VolumesPrune", reflect.TypeOf((*MockAPIClient)(nil).VolumesPrune), arg0, arg1) +} From 4140196eb07655307609465f6673644cd48f242b Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Thu, 11 Feb 2021 11:12:50 +0100 Subject: [PATCH 2/6] Add down unit tests Signed-off-by: Guillaume Tardif --- local/compose/create.go | 6 +- local/compose/down.go | 20 +++--- local/compose/down_test.go | 83 +++++++++++++++++++++++ local/compose/kill_test.go | 36 +++++----- local/compose/ps.go | 6 +- local/compose/testdata/docker-compose.yml | 5 ++ 6 files changed, 117 insertions(+), 39 deletions(-) create mode 100644 local/compose/down_test.go create mode 100644 local/compose/testdata/docker-compose.yml diff --git a/local/compose/create.go b/local/compose/create.go index 7e4f2af8..cb24cde4 100644 --- a/local/compose/create.go +++ b/local/compose/create.go @@ -64,10 +64,8 @@ func (s *composeService) Create(ctx context.Context, project *types.Project, opt var observedState Containers observedState, err = s.apiClient.ContainerList(ctx, moby.ContainerListOptions{ - Filters: filters.NewArgs( - projectFilter(project.Name), - ), - All: true, + Filters: filters.NewArgs(projectFilter(project.Name)), + All: true, }) if err != nil { return err diff --git a/local/compose/down.go b/local/compose/down.go index 0bd583ce..e60912e6 100644 --- a/local/compose/down.go +++ b/local/compose/down.go @@ -73,11 +73,7 @@ func (s *composeService) Down(ctx context.Context, projectName string, options c } } - networks, err := s.apiClient.NetworkList(ctx, moby.NetworkListOptions{ - Filters: filters.NewArgs( - projectFilter(projectName), - ), - }) + networks, err := s.apiClient.NetworkList(ctx, moby.NetworkListOptions{Filters: filters.NewArgs(projectFilter(projectName))}) if err != nil { return err } @@ -137,13 +133,15 @@ func (s *composeService) removeContainers(ctx context.Context, w progress.Writer return eg.Wait() } +func projectFilterListOpt(projectName string) moby.ContainerListOptions { + return moby.ContainerListOptions{ + Filters: filters.NewArgs(projectFilter(projectName)), + All: true, + } +} + func (s *composeService) projectFromContainerLabels(ctx context.Context, projectName string) (*types.Project, error) { - containers, err := s.apiClient.ContainerList(ctx, moby.ContainerListOptions{ - Filters: filters.NewArgs( - projectFilter(projectName), - ), - All: true, - }) + containers, err := s.apiClient.ContainerList(ctx, projectFilterListOpt(projectName)) if err != nil { return nil, err } diff --git a/local/compose/down_test.go b/local/compose/down_test.go new file mode 100644 index 00000000..7ebf0af9 --- /dev/null +++ b/local/compose/down_test.go @@ -0,0 +1,83 @@ +/* + Copyright 2020 Docker Compose CLI authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package compose + +import ( + "context" + "testing" + + "github.com/golang/mock/gomock" + "gotest.tools/v3/assert" + + apitypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/filters" + + "github.com/docker/compose-cli/api/compose" + "github.com/docker/compose-cli/local/mocks" +) + +func TestDown(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + api := mocks.NewMockAPIClient(mockCtrl) + tested.apiClient = api + + ctx := context.Background() + api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return( + []apitypes.Container{testContainer("service1", "123"), testContainer("service1", "456"), testContainer("service2", "789"), testContainer("service_orphan", "321")}, nil).Times(2) + + api.EXPECT().ContainerStop(ctx, "123", nil).Return(nil) + api.EXPECT().ContainerStop(ctx, "456", nil).Return(nil) + api.EXPECT().ContainerStop(ctx, "789", nil).Return(nil) + + api.EXPECT().ContainerRemove(ctx, "123", apitypes.ContainerRemoveOptions{Force: true}).Return(nil) + api.EXPECT().ContainerRemove(ctx, "456", apitypes.ContainerRemoveOptions{Force: true}).Return(nil) + api.EXPECT().ContainerRemove(ctx, "789", apitypes.ContainerRemoveOptions{Force: true}).Return(nil) + + api.EXPECT().NetworkList(ctx, apitypes.NetworkListOptions{Filters: filters.NewArgs(projectFilter(testProject))}).Return([]apitypes.NetworkResource{{ID: "myProject_default"}}, nil) + + api.EXPECT().NetworkRemove(ctx, "myProject_default").Return(nil) + + err := tested.Down(ctx, testProject, compose.DownOptions{}) + assert.NilError(t, err) +} + +func TestDownRemoveOrphans(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + api := mocks.NewMockAPIClient(mockCtrl) + tested.apiClient = api + + ctx := context.Background() + api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return( + []apitypes.Container{testContainer("service1", "123"), testContainer("service2", "789"), testContainer("service_orphan", "321")}, nil).Times(2) + + api.EXPECT().ContainerStop(ctx, "123", nil).Return(nil) + api.EXPECT().ContainerStop(ctx, "789", nil).Return(nil) + api.EXPECT().ContainerStop(ctx, "321", nil).Return(nil) + + api.EXPECT().ContainerRemove(ctx, "123", apitypes.ContainerRemoveOptions{Force: true}).Return(nil) + api.EXPECT().ContainerRemove(ctx, "789", apitypes.ContainerRemoveOptions{Force: true}).Return(nil) + api.EXPECT().ContainerRemove(ctx, "321", apitypes.ContainerRemoveOptions{Force: true}).Return(nil) + + api.EXPECT().NetworkList(ctx, apitypes.NetworkListOptions{Filters: filters.NewArgs(projectFilter(testProject))}).Return([]apitypes.NetworkResource{{ID: "myProject_default"}}, nil) + + api.EXPECT().NetworkRemove(ctx, "myProject_default").Return(nil) + + err := tested.Down(ctx, testProject, compose.DownOptions{RemoveOrphans: true}) + assert.NilError(t, err) +} diff --git a/local/compose/kill_test.go b/local/compose/kill_test.go index bf03f6b0..435ff74c 100644 --- a/local/compose/kill_test.go +++ b/local/compose/kill_test.go @@ -20,40 +20,36 @@ import ( "context" "testing" - "github.com/compose-spec/compose-go/types" - apitypes "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/filters" - "github.com/golang/mock/gomock" "gotest.tools/v3/assert" + "github.com/compose-spec/compose-go/types" + apitypes "github.com/docker/docker/api/types" + "github.com/docker/compose-cli/api/compose" "github.com/docker/compose-cli/local/mocks" ) -var ( - s = composeService{} - projectListOpts = apitypes.ContainerListOptions{ - Filters: filters.NewArgs(projectFilter("myProject")), - All: true, - } -) +const testProject = "testProject" + +var tested = composeService{} func TestKillAll(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() api := mocks.NewMockAPIClient(mockCtrl) - s.apiClient = api + tested.apiClient = api - project := types.Project{Name: "myProject", Services: []types.ServiceConfig{testService("service1"), testService("service2")}} + project := types.Project{Name: testProject, Services: []types.ServiceConfig{testService("service1"), testService("service2")}} ctx := context.Background() - api.EXPECT().ContainerList(ctx, projectListOpts).Return([]apitypes.Container{testContainer("service1", "123"), testContainer("service1", "456"), testContainer("service2", "789")}, nil) + api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return( + []apitypes.Container{testContainer("service1", "123"), testContainer("service1", "456"), testContainer("service2", "789")}, nil) api.EXPECT().ContainerKill(anyCancellableContext(), "123", "").Return(nil) api.EXPECT().ContainerKill(anyCancellableContext(), "456", "").Return(nil) api.EXPECT().ContainerKill(anyCancellableContext(), "789", "").Return(nil) - err := s.Kill(ctx, &project, compose.KillOptions{}) + err := tested.Kill(ctx, &project, compose.KillOptions{}) assert.NilError(t, err) } @@ -61,15 +57,15 @@ func TestKillSignal(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() api := mocks.NewMockAPIClient(mockCtrl) - s.apiClient = api + tested.apiClient = api - project := types.Project{Name: "myProject", Services: []types.ServiceConfig{testService("service1")}} + project := types.Project{Name: testProject, Services: []types.ServiceConfig{testService("service1")}} ctx := context.Background() - api.EXPECT().ContainerList(ctx, projectListOpts).Return([]apitypes.Container{testContainer("service1", "123")}, nil) + api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return([]apitypes.Container{testContainer("service1", "123")}, nil) api.EXPECT().ContainerKill(anyCancellableContext(), "123", "SIGTERM").Return(nil) - err := s.Kill(ctx, &project, compose.KillOptions{Signal: "SIGTERM"}) + err := tested.Kill(ctx, &project, compose.KillOptions{Signal: "SIGTERM"}) assert.NilError(t, err) } @@ -81,7 +77,7 @@ func testContainer(service string, id string) apitypes.Container { return apitypes.Container{ ID: id, Names: []string{id}, - Labels: map[string]string{compose.ServiceTag: service}, + Labels: map[string]string{serviceLabel: service, configFilesLabel: "testdata/docker-compose.yml", workingDirLabel: "testdata", projectLabel: testProject}, } } diff --git a/local/compose/ps.go b/local/compose/ps.go index 264f2ecf..a95cbd84 100644 --- a/local/compose/ps.go +++ b/local/compose/ps.go @@ -30,10 +30,8 @@ import ( func (s *composeService) Ps(ctx context.Context, projectName string, options compose.PsOptions) ([]compose.ContainerSummary, error) { containers, err := s.apiClient.ContainerList(ctx, moby.ContainerListOptions{ - Filters: filters.NewArgs( - projectFilter(projectName), - ), - All: options.All, + Filters: filters.NewArgs(projectFilter(projectName)), + All: options.All, }) if err != nil { return nil, err diff --git a/local/compose/testdata/docker-compose.yml b/local/compose/testdata/docker-compose.yml new file mode 100644 index 00000000..4e3e6cb9 --- /dev/null +++ b/local/compose/testdata/docker-compose.yml @@ -0,0 +1,5 @@ +services: + service1: + image: nginx + service2: + image: mysql From b4fa7b2fa34b130c1e5c0f04ea9503458519eb5c Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Thu, 11 Feb 2021 12:39:51 +0100 Subject: [PATCH 3/6] PS unit test Signed-off-by: Guillaume Tardif --- local/compose/kill_test.go | 6 ++- local/compose/ls.go | 20 ++++++++ local/compose/ps.go | 21 --------- local/compose/ps_test.go | 94 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 22 deletions(-) create mode 100644 local/compose/ps_test.go diff --git a/local/compose/kill_test.go b/local/compose/kill_test.go index 435ff74c..5b6d78aa 100644 --- a/local/compose/kill_test.go +++ b/local/compose/kill_test.go @@ -77,10 +77,14 @@ func testContainer(service string, id string) apitypes.Container { return apitypes.Container{ ID: id, Names: []string{id}, - Labels: map[string]string{serviceLabel: service, configFilesLabel: "testdata/docker-compose.yml", workingDirLabel: "testdata", projectLabel: testProject}, + Labels: containerLabels(service), } } +func containerLabels(service string) map[string]string { + return map[string]string{serviceLabel: service, configFilesLabel: "testdata/docker-compose.yml", workingDirLabel: "testdata", projectLabel: testProject} +} + func anyCancellableContext() gomock.Matcher { ctxWithCancel, cancel := context.WithCancel(context.Background()) cancel() diff --git a/local/compose/ls.go b/local/compose/ls.go index 1466d3a0..2df40753 100644 --- a/local/compose/ls.go +++ b/local/compose/ls.go @@ -84,3 +84,23 @@ func combinedStatus(statuses []string) string { } return result } + +func groupContainerByLabel(containers []moby.Container, labelName string) (map[string][]moby.Container, []string, error) { + containersByLabel := map[string][]moby.Container{} + keys := []string{} + for _, c := range containers { + label, ok := c.Labels[labelName] + if !ok { + return nil, nil, fmt.Errorf("No label %q set on container %q of compose project", labelName, c.ID) + } + labelContainers, ok := containersByLabel[label] + if !ok { + labelContainers = []moby.Container{} + keys = append(keys, label) + } + labelContainers = append(labelContainers, c) + containersByLabel[label] = labelContainers + } + sort.Strings(keys) + return containersByLabel, keys, nil +} diff --git a/local/compose/ps.go b/local/compose/ps.go index a95cbd84..4289ca6a 100644 --- a/local/compose/ps.go +++ b/local/compose/ps.go @@ -19,7 +19,6 @@ package compose import ( "context" "fmt" - "sort" moby "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" @@ -81,23 +80,3 @@ func (s *composeService) Ps(ctx context.Context, projectName string, options com } return summary, eg.Wait() } - -func groupContainerByLabel(containers []moby.Container, labelName string) (map[string][]moby.Container, []string, error) { - containersByLabel := map[string][]moby.Container{} - keys := []string{} - for _, c := range containers { - label, ok := c.Labels[labelName] - if !ok { - return nil, nil, fmt.Errorf("No label %q set on container %q of compose project", labelName, c.ID) - } - labelContainers, ok := containersByLabel[label] - if !ok { - labelContainers = []moby.Container{} - keys = append(keys, label) - } - labelContainers = append(labelContainers, c) - containersByLabel[label] = labelContainers - } - sort.Strings(keys) - return containersByLabel, keys, nil -} diff --git a/local/compose/ps_test.go b/local/compose/ps_test.go new file mode 100644 index 00000000..619bd33f --- /dev/null +++ b/local/compose/ps_test.go @@ -0,0 +1,94 @@ +/* + Copyright 2020 Docker Compose CLI authors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package compose + +import ( + "context" + "testing" + + "github.com/golang/mock/gomock" + "gotest.tools/v3/assert" + + apitypes "github.com/docker/docker/api/types" + "github.com/docker/docker/api/types/filters" + + "github.com/docker/compose-cli/api/compose" + "github.com/docker/compose-cli/local/mocks" +) + +func TestPs(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + api := mocks.NewMockAPIClient(mockCtrl) + tested.apiClient = api + + ctx := context.Background() + listOpts := apitypes.ContainerListOptions{Filters: filters.NewArgs(projectFilter(testProject)), All: false} + c1, inspect1 := containerDetails("service1", "123", "Running", "healthy") + c2, inspect2 := containerDetails("service1", "456", "Running", "") + c2.Ports = []apitypes.Port{{PublicPort: 80, PrivatePort: 90, IP: "localhost"}} + c3, inspect3 := containerDetails("service2", "789", "Running", "") + api.EXPECT().ContainerList(ctx, listOpts).Return([]apitypes.Container{c1, c2, c3}, nil) + api.EXPECT().ContainerInspect(anyCancellableContext(), "123").Return(inspect1, nil) + api.EXPECT().ContainerInspect(anyCancellableContext(), "456").Return(inspect2, nil) + api.EXPECT().ContainerInspect(anyCancellableContext(), "789").Return(inspect3, nil) + + containers, err := tested.Ps(ctx, testProject, compose.PsOptions{}) + + expected := []compose.ContainerSummary{ + {ID: "123", Name: "123", Project: testProject, Service: "service1", State: "Running", Health: "healthy", Publishers: nil}, + {ID: "456", Name: "456", Project: testProject, Service: "service1", State: "Running", Health: "", Publishers: []compose.PortPublisher{{URL: "localhost:80", TargetPort: 90, PublishedPort: 80}}}, + {ID: "789", Name: "789", Project: testProject, Service: "service2", State: "Running", Health: "", Publishers: nil}, + } + assert.NilError(t, err) + assert.DeepEqual(t, containers, expected) +} + +func TestPsAll(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + api := mocks.NewMockAPIClient(mockCtrl) + tested.apiClient = api + + ctx := context.Background() + listOpts := apitypes.ContainerListOptions{Filters: filters.NewArgs(projectFilter(testProject)), All: true} + c1, inspect1 := containerDetails("service1", "123", "Running", "healthy") + c2, inspect2 := containerDetails("service1", "456", "Stopped", "") + api.EXPECT().ContainerList(ctx, listOpts).Return([]apitypes.Container{c1, c2}, nil) + api.EXPECT().ContainerInspect(anyCancellableContext(), "123").Return(inspect1, nil) + api.EXPECT().ContainerInspect(anyCancellableContext(), "456").Return(inspect2, nil) + + containers, err := tested.Ps(ctx, testProject, compose.PsOptions{All: true}) + + expected := []compose.ContainerSummary{ + {ID: "123", Name: "123", Project: testProject, Service: "service1", State: "Running", Health: "healthy", Publishers: nil}, + {ID: "456", Name: "456", Project: testProject, Service: "service1", State: "Stopped", Health: "", Publishers: nil}, + } + assert.NilError(t, err) + assert.DeepEqual(t, containers, expected) +} + +func containerDetails(service string, id string, status string, health string) (apitypes.Container, apitypes.ContainerJSON) { + container := apitypes.Container{ + ID: id, + Names: []string{"/" + id}, + Labels: containerLabels(service), + State: status, + } + inspect := apitypes.ContainerJSON{ContainerJSONBase: &apitypes.ContainerJSONBase{State: &apitypes.ContainerState{Status: status, Health: &apitypes.Health{Status: health}}}} + return container, inspect +} From ac5c422d779d054af05c2c14b62948bc991e8eba Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 12 Feb 2021 09:45:00 +0100 Subject: [PATCH 4/6] Better debug info if test fail Signed-off-by: Guillaume Tardif --- local/compose/down_test.go | 4 +++- local/e2e/container/container_test.go | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/local/compose/down_test.go b/local/compose/down_test.go index 7ebf0af9..0f876e5f 100644 --- a/local/compose/down_test.go +++ b/local/compose/down_test.go @@ -64,7 +64,9 @@ func TestDownRemoveOrphans(t *testing.T) { ctx := context.Background() api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return( - []apitypes.Container{testContainer("service1", "123"), testContainer("service2", "789"), testContainer("service_orphan", "321")}, nil).Times(2) + []apitypes.Container{testContainer("service1", "123"), + testContainer("service2", "789"), + testContainer("service_orphan", "321")}, nil).Times(2) api.EXPECT().ContainerStop(ctx, "123", nil).Return(nil) api.EXPECT().ContainerStop(ctx, "789", nil).Return(nil) diff --git a/local/e2e/container/container_test.go b/local/e2e/container/container_test.go index 8edd2063..103cdbd9 100644 --- a/local/e2e/container/container_test.go +++ b/local/e2e/container/container_test.go @@ -101,9 +101,9 @@ func TestLocalBackendRun(t *testing.T) { fields := strings.Fields(line) if fields[0] == nginxID { nginxFound = true - assert.Equal(t, fields[1], "nginx") - assert.Equal(t, fields[2], "/docker-entrypoint.sh") - assert.Equal(t, fields[len(fields)-1], "0.0.0.0:85->80/tcp") + assert.Equal(t, fields[1], "nginx", res.Combined()) + assert.Equal(t, fields[2], "/docker-entrypoint.sh", res.Combined()) + assert.Equal(t, fields[len(fields)-1], "0.0.0.0:85->80/tcp", res.Combined()) } } assert.Assert(t, nginxFound, res.Stdout()) From fbe1ebc054ed5132bae50ca0466ae836df48a909 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 12 Feb 2021 09:52:04 +0100 Subject: [PATCH 5/6] Fix test name and avoid project name collision between parallel tests, Signed-off-by: Guillaume Tardif --- local/e2e/compose/cascade_stop_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local/e2e/compose/cascade_stop_test.go b/local/e2e/compose/cascade_stop_test.go index b25f5438..45b494c3 100644 --- a/local/e2e/compose/cascade_stop_test.go +++ b/local/e2e/compose/cascade_stop_test.go @@ -27,7 +27,7 @@ import ( func TestCascadeStop(t *testing.T) { c := NewParallelE2eCLI(t, binDir) - const projectName = "compose-e2e-logs" + const projectName = "e2e-cascade-stop" t.Run("abort-on-container-exit", func(t *testing.T) { res := c.RunDockerOrExitError("compose", "-f", "./fixtures/cascade-stop-test/compose.yaml", "--project-name", projectName, "up", "--abort-on-container-exit") From d720eb6c0338e3703bfe26788143e6d539d1036e Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Fri, 12 Feb 2021 10:13:14 +0100 Subject: [PATCH 6/6] Fix race (parallel update of collection) to remove orphan containers Signed-off-by: Guillaume Tardif --- local/compose/containers.go | 14 -------------- local/compose/down.go | 8 ++++---- local/compose/down_test.go | 4 +--- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/local/compose/containers.go b/local/compose/containers.go index 470c96ff..0e995b81 100644 --- a/local/compose/containers.go +++ b/local/compose/containers.go @@ -70,20 +70,6 @@ func (containers Containers) filter(predicate containerPredicate) Containers { return filtered } -// split return Containers with elements to match and those not to match predicate -func (containers Containers) split(predicate containerPredicate) (Containers, Containers) { - var right Containers - var left Containers - for _, c := range containers { - if predicate(c) { - right = append(right, c) - } else { - left = append(left, c) - } - } - return right, left -} - func (containers Containers) names() []string { var names []string for _, c := range containers { diff --git a/local/compose/down.go b/local/compose/down.go index e60912e6..6e7cc1e9 100644 --- a/local/compose/down.go +++ b/local/compose/down.go @@ -57,17 +57,17 @@ func (s *composeService) Down(ctx context.Context, projectName string, options c } err = InReverseDependencyOrder(ctx, options.Project, func(c context.Context, service types.ServiceConfig) error { - serviceContainers, others := containers.split(isService(service.Name)) + serviceContainers := containers.filter(isService(service.Name)) err := s.removeContainers(ctx, w, serviceContainers) - containers = others return err }) if err != nil { return err } - if options.RemoveOrphans && len(containers) > 0 { - err := s.removeContainers(ctx, w, containers) + orphans := containers.filter(isNotService(options.Project.ServiceNames()...)) + if options.RemoveOrphans && len(orphans) > 0 { + err := s.removeContainers(ctx, w, orphans) if err != nil { return err } diff --git a/local/compose/down_test.go b/local/compose/down_test.go index 0f876e5f..7ebf0af9 100644 --- a/local/compose/down_test.go +++ b/local/compose/down_test.go @@ -64,9 +64,7 @@ func TestDownRemoveOrphans(t *testing.T) { ctx := context.Background() api.EXPECT().ContainerList(ctx, projectFilterListOpt(testProject)).Return( - []apitypes.Container{testContainer("service1", "123"), - testContainer("service2", "789"), - testContainer("service_orphan", "321")}, nil).Times(2) + []apitypes.Container{testContainer("service1", "123"), testContainer("service2", "789"), testContainer("service_orphan", "321")}, nil).Times(2) api.EXPECT().ContainerStop(ctx, "123", nil).Return(nil) api.EXPECT().ContainerStop(ctx, "789", nil).Return(nil)