-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathmocks_test.go
85 lines (75 loc) · 2.44 KB
/
mocks_test.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package main
import "github.com/stretchr/testify/mock"
type DockerComposeMock struct {
mock.Mock
}
func (m *DockerComposeMock) CreateFlowFile(
dcPath,
serviceName,
target string,
sideTargets []string,
color string,
blueGreen bool,
) error {
args := m.Called(dcPath, serviceName, target, sideTargets, color, blueGreen)
return args.Error(0)
}
func (m *DockerComposeMock) RemoveFlow() error {
args := m.Called()
return args.Error(0)
}
func (m *DockerComposeMock) PullTargets(host, certPath, project string, targets []string) error {
args := m.Called(host, certPath, project, targets)
return args.Error(0)
}
func (m *DockerComposeMock) UpTargets(host, certPath, project string, targets []string) error {
args := m.Called(host, certPath, project, targets)
return args.Error(0)
}
func (m *DockerComposeMock) ScaleTargets(host, certPath, project, target string, scale int) error {
args := m.Called(host, certPath, project, target, scale)
return args.Error(0)
}
func (m *DockerComposeMock) RmTargets(host, certPath, project string, targets []string) error {
args := m.Called(host, certPath, project, targets)
return args.Error(0)
}
func (m *DockerComposeMock) StopTargets(host, certPath, project string, targets []string) error {
args := m.Called(host, certPath, project, targets)
return args.Error(0)
}
func getDockerComposeMock(opts Opts, skipMethod string) *DockerComposeMock {
mockObj := new(DockerComposeMock)
if skipMethod != "PullTargets" {
mockObj.On("PullTargets", opts.Host, opts.CertPath, opts.Project, Flow{}.GetPullTargets(opts)).Return(nil)
}
if skipMethod != "UpTargets" {
mockObj.On("UpTargets", opts.Host, opts.CertPath, opts.Project, append(opts.SideTargets, opts.NextTarget)).Return(nil)
}
if skipMethod != "RmTargets" {
mockObj.On("RmTargets", opts.Host, opts.CertPath, opts.Project, []string{opts.NextTarget}).Return(nil)
}
if skipMethod != "ScaleTargets" {
mockObj.On("ScaleTargets", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
}
if skipMethod != "CreateFlowFile" {
mockObj.On(
"CreateFlowFile",
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
mock.Anything,
).Return(nil)
}
if skipMethod != "StopTargets" {
mockObj.On("StopTargets", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil)
}
if skipMethod != "RemoveFlow" {
mockObj.On("RemoveFlow").Return(nil)
}
return mockObj
}