This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
client_mock.go
64 lines (51 loc) · 2.17 KB
/
client_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package mocks
import (
"context"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/client"
"github.com/stretchr/testify/mock"
)
type ContainerAPIClientMock struct {
client.ContainerAPIClient
mock.Mock
}
func NewContainerAPIClientMock() *ContainerAPIClientMock {
return &ContainerAPIClientMock{}
}
func (client *ContainerAPIClientMock) ContainerStart(ctx context.Context, container string, options types.ContainerStartOptions) error {
args := client.Mock.Called(ctx, container, options)
return args.Error(0)
}
func (client *ContainerAPIClientMock) ContainerStop(ctx context.Context, container string, timeout *time.Duration) error {
args := client.Mock.Called(ctx, container, timeout)
return args.Error(0)
}
func (client *ContainerAPIClientMock) ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error) {
args := client.Mock.Called(ctx, container)
return args.Get(0).(types.ContainerJSON), args.Error(1)
}
func (client *ContainerAPIClientMock) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
args := client.Mock.Called(ctx, options)
return args.Get(0).([]types.Container), args.Error(1)
}
type ServiceAPIClientMock struct {
client.ServiceAPIClient
mock.Mock
}
func NewServiceAPIClientMock() *ServiceAPIClientMock {
return &ServiceAPIClientMock{}
}
func (client *ServiceAPIClientMock) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error) {
args := client.Mock.Called(ctx, serviceID, version, service, options)
return args.Get(0).(types.ServiceUpdateResponse), args.Error(1)
}
func (client *ServiceAPIClientMock) ServiceList(ctx context.Context, options types.ServiceListOptions) ([]swarm.Service, error) {
args := client.Mock.Called(ctx, options)
return args.Get(0).([]swarm.Service), args.Error(1)
}
func (client *ServiceAPIClientMock) TaskList(ctx context.Context, options types.TaskListOptions) ([]swarm.Task, error) {
args := client.Mock.Called(ctx, options)
return args.Get(0).([]swarm.Task), args.Error(1)
}