/
fake_network_depot.go
200 lines (182 loc) · 5.77 KB
/
fake_network_depot.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// Code generated by counterfeiter. DO NOT EDIT.
package kawasakifakes
import (
"sync"
"code.cloudfoundry.org/garden"
"code.cloudfoundry.org/guardian/kawasaki"
lager "code.cloudfoundry.org/lager/v3"
)
type FakeNetworkDepot struct {
DestroyStub func(lager.Logger, string) error
destroyMutex sync.RWMutex
destroyArgsForCall []struct {
arg1 lager.Logger
arg2 string
}
destroyReturns struct {
result1 error
}
destroyReturnsOnCall map[int]struct {
result1 error
}
SetupBindMountsStub func(lager.Logger, string, bool, string) ([]garden.BindMount, error)
setupBindMountsMutex sync.RWMutex
setupBindMountsArgsForCall []struct {
arg1 lager.Logger
arg2 string
arg3 bool
arg4 string
}
setupBindMountsReturns struct {
result1 []garden.BindMount
result2 error
}
setupBindMountsReturnsOnCall map[int]struct {
result1 []garden.BindMount
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeNetworkDepot) Destroy(arg1 lager.Logger, arg2 string) error {
fake.destroyMutex.Lock()
ret, specificReturn := fake.destroyReturnsOnCall[len(fake.destroyArgsForCall)]
fake.destroyArgsForCall = append(fake.destroyArgsForCall, struct {
arg1 lager.Logger
arg2 string
}{arg1, arg2})
stub := fake.DestroyStub
fakeReturns := fake.destroyReturns
fake.recordInvocation("Destroy", []interface{}{arg1, arg2})
fake.destroyMutex.Unlock()
if stub != nil {
return stub(arg1, arg2)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeNetworkDepot) DestroyCallCount() int {
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
return len(fake.destroyArgsForCall)
}
func (fake *FakeNetworkDepot) DestroyCalls(stub func(lager.Logger, string) error) {
fake.destroyMutex.Lock()
defer fake.destroyMutex.Unlock()
fake.DestroyStub = stub
}
func (fake *FakeNetworkDepot) DestroyArgsForCall(i int) (lager.Logger, string) {
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
argsForCall := fake.destroyArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeNetworkDepot) DestroyReturns(result1 error) {
fake.destroyMutex.Lock()
defer fake.destroyMutex.Unlock()
fake.DestroyStub = nil
fake.destroyReturns = struct {
result1 error
}{result1}
}
func (fake *FakeNetworkDepot) DestroyReturnsOnCall(i int, result1 error) {
fake.destroyMutex.Lock()
defer fake.destroyMutex.Unlock()
fake.DestroyStub = nil
if fake.destroyReturnsOnCall == nil {
fake.destroyReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.destroyReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeNetworkDepot) SetupBindMounts(arg1 lager.Logger, arg2 string, arg3 bool, arg4 string) ([]garden.BindMount, error) {
fake.setupBindMountsMutex.Lock()
ret, specificReturn := fake.setupBindMountsReturnsOnCall[len(fake.setupBindMountsArgsForCall)]
fake.setupBindMountsArgsForCall = append(fake.setupBindMountsArgsForCall, struct {
arg1 lager.Logger
arg2 string
arg3 bool
arg4 string
}{arg1, arg2, arg3, arg4})
stub := fake.SetupBindMountsStub
fakeReturns := fake.setupBindMountsReturns
fake.recordInvocation("SetupBindMounts", []interface{}{arg1, arg2, arg3, arg4})
fake.setupBindMountsMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4)
}
if specificReturn {
return ret.result1, ret.result2
}
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeNetworkDepot) SetupBindMountsCallCount() int {
fake.setupBindMountsMutex.RLock()
defer fake.setupBindMountsMutex.RUnlock()
return len(fake.setupBindMountsArgsForCall)
}
func (fake *FakeNetworkDepot) SetupBindMountsCalls(stub func(lager.Logger, string, bool, string) ([]garden.BindMount, error)) {
fake.setupBindMountsMutex.Lock()
defer fake.setupBindMountsMutex.Unlock()
fake.SetupBindMountsStub = stub
}
func (fake *FakeNetworkDepot) SetupBindMountsArgsForCall(i int) (lager.Logger, string, bool, string) {
fake.setupBindMountsMutex.RLock()
defer fake.setupBindMountsMutex.RUnlock()
argsForCall := fake.setupBindMountsArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeNetworkDepot) SetupBindMountsReturns(result1 []garden.BindMount, result2 error) {
fake.setupBindMountsMutex.Lock()
defer fake.setupBindMountsMutex.Unlock()
fake.SetupBindMountsStub = nil
fake.setupBindMountsReturns = struct {
result1 []garden.BindMount
result2 error
}{result1, result2}
}
func (fake *FakeNetworkDepot) SetupBindMountsReturnsOnCall(i int, result1 []garden.BindMount, result2 error) {
fake.setupBindMountsMutex.Lock()
defer fake.setupBindMountsMutex.Unlock()
fake.SetupBindMountsStub = nil
if fake.setupBindMountsReturnsOnCall == nil {
fake.setupBindMountsReturnsOnCall = make(map[int]struct {
result1 []garden.BindMount
result2 error
})
}
fake.setupBindMountsReturnsOnCall[i] = struct {
result1 []garden.BindMount
result2 error
}{result1, result2}
}
func (fake *FakeNetworkDepot) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
fake.setupBindMountsMutex.RLock()
defer fake.setupBindMountsMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeNetworkDepot) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ kawasaki.NetworkDepot = new(FakeNetworkDepot)