-
Notifications
You must be signed in to change notification settings - Fork 41
/
cluster_network_provider_moq.go
361 lines (336 loc) · 13.4 KB
/
cluster_network_provider_moq.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package gcp
import (
"cloud.google.com/go/compute/apiv1/computepb"
"context"
croType "github.com/integr8ly/cloud-resource-operator/apis/integreatly/v1alpha1/types"
"google.golang.org/api/servicenetworking/v1"
"net"
"sync"
)
// Ensure, that NetworkManagerMock does implement NetworkManager.
// If this is not the case, regenerate this file with moq.
var _ NetworkManager = &NetworkManagerMock{}
// NetworkManagerMock is a mock implementation of NetworkManager.
//
// func TestSomethingThatUsesNetworkManager(t *testing.T) {
//
// // make and configure a mocked NetworkManager
// mockedNetworkManager := &NetworkManagerMock{
// ComponentsExistFunc: func(contextMoqParam context.Context) (bool, error) {
// panic("mock out the ComponentsExist method")
// },
// CreateNetworkIpRangeFunc: func(contextMoqParam context.Context, iPNet *net.IPNet) (*computepb.Address, croType.StatusMessage, error) {
// panic("mock out the CreateNetworkIpRange method")
// },
// CreateNetworkServiceFunc: func(contextMoqParam context.Context) (*servicenetworking.Connection, croType.StatusMessage, error) {
// panic("mock out the CreateNetworkService method")
// },
// DeleteNetworkIpRangeFunc: func(contextMoqParam context.Context) error {
// panic("mock out the DeleteNetworkIpRange method")
// },
// DeleteNetworkPeeringFunc: func(contextMoqParam context.Context) error {
// panic("mock out the DeleteNetworkPeering method")
// },
// DeleteNetworkServiceFunc: func(contextMoqParam context.Context) error {
// panic("mock out the DeleteNetworkService method")
// },
// ReconcileNetworkProviderConfigFunc: func(ctx context.Context, configManager ConfigManager, tier string) (*net.IPNet, error) {
// panic("mock out the ReconcileNetworkProviderConfig method")
// },
// }
//
// // use mockedNetworkManager in code that requires NetworkManager
// // and then make assertions.
//
// }
type NetworkManagerMock struct {
// ComponentsExistFunc mocks the ComponentsExist method.
ComponentsExistFunc func(contextMoqParam context.Context) (bool, error)
// CreateNetworkIpRangeFunc mocks the CreateNetworkIpRange method.
CreateNetworkIpRangeFunc func(contextMoqParam context.Context, iPNet *net.IPNet) (*computepb.Address, croType.StatusMessage, error)
// CreateNetworkServiceFunc mocks the CreateNetworkService method.
CreateNetworkServiceFunc func(contextMoqParam context.Context) (*servicenetworking.Connection, croType.StatusMessage, error)
// DeleteNetworkIpRangeFunc mocks the DeleteNetworkIpRange method.
DeleteNetworkIpRangeFunc func(contextMoqParam context.Context) error
// DeleteNetworkPeeringFunc mocks the DeleteNetworkPeering method.
DeleteNetworkPeeringFunc func(contextMoqParam context.Context) error
// DeleteNetworkServiceFunc mocks the DeleteNetworkService method.
DeleteNetworkServiceFunc func(contextMoqParam context.Context) error
// ReconcileNetworkProviderConfigFunc mocks the ReconcileNetworkProviderConfig method.
ReconcileNetworkProviderConfigFunc func(ctx context.Context, configManager ConfigManager, tier string) (*net.IPNet, error)
// calls tracks calls to the methods.
calls struct {
// ComponentsExist holds details about calls to the ComponentsExist method.
ComponentsExist []struct {
// ContextMoqParam is the contextMoqParam argument value.
ContextMoqParam context.Context
}
// CreateNetworkIpRange holds details about calls to the CreateNetworkIpRange method.
CreateNetworkIpRange []struct {
// ContextMoqParam is the contextMoqParam argument value.
ContextMoqParam context.Context
// IPNet is the iPNet argument value.
IPNet *net.IPNet
}
// CreateNetworkService holds details about calls to the CreateNetworkService method.
CreateNetworkService []struct {
// ContextMoqParam is the contextMoqParam argument value.
ContextMoqParam context.Context
}
// DeleteNetworkIpRange holds details about calls to the DeleteNetworkIpRange method.
DeleteNetworkIpRange []struct {
// ContextMoqParam is the contextMoqParam argument value.
ContextMoqParam context.Context
}
// DeleteNetworkPeering holds details about calls to the DeleteNetworkPeering method.
DeleteNetworkPeering []struct {
// ContextMoqParam is the contextMoqParam argument value.
ContextMoqParam context.Context
}
// DeleteNetworkService holds details about calls to the DeleteNetworkService method.
DeleteNetworkService []struct {
// ContextMoqParam is the contextMoqParam argument value.
ContextMoqParam context.Context
}
// ReconcileNetworkProviderConfig holds details about calls to the ReconcileNetworkProviderConfig method.
ReconcileNetworkProviderConfig []struct {
// Ctx is the ctx argument value.
Ctx context.Context
// ConfigManager is the configManager argument value.
ConfigManager ConfigManager
// Tier is the tier argument value.
Tier string
}
}
lockComponentsExist sync.RWMutex
lockCreateNetworkIpRange sync.RWMutex
lockCreateNetworkService sync.RWMutex
lockDeleteNetworkIpRange sync.RWMutex
lockDeleteNetworkPeering sync.RWMutex
lockDeleteNetworkService sync.RWMutex
lockReconcileNetworkProviderConfig sync.RWMutex
}
// ComponentsExist calls ComponentsExistFunc.
func (mock *NetworkManagerMock) ComponentsExist(contextMoqParam context.Context) (bool, error) {
if mock.ComponentsExistFunc == nil {
panic("NetworkManagerMock.ComponentsExistFunc: method is nil but NetworkManager.ComponentsExist was just called")
}
callInfo := struct {
ContextMoqParam context.Context
}{
ContextMoqParam: contextMoqParam,
}
mock.lockComponentsExist.Lock()
mock.calls.ComponentsExist = append(mock.calls.ComponentsExist, callInfo)
mock.lockComponentsExist.Unlock()
return mock.ComponentsExistFunc(contextMoqParam)
}
// ComponentsExistCalls gets all the calls that were made to ComponentsExist.
// Check the length with:
//
// len(mockedNetworkManager.ComponentsExistCalls())
func (mock *NetworkManagerMock) ComponentsExistCalls() []struct {
ContextMoqParam context.Context
} {
var calls []struct {
ContextMoqParam context.Context
}
mock.lockComponentsExist.RLock()
calls = mock.calls.ComponentsExist
mock.lockComponentsExist.RUnlock()
return calls
}
// CreateNetworkIpRange calls CreateNetworkIpRangeFunc.
func (mock *NetworkManagerMock) CreateNetworkIpRange(contextMoqParam context.Context, iPNet *net.IPNet) (*computepb.Address, croType.StatusMessage, error) {
if mock.CreateNetworkIpRangeFunc == nil {
panic("NetworkManagerMock.CreateNetworkIpRangeFunc: method is nil but NetworkManager.CreateNetworkIpRange was just called")
}
callInfo := struct {
ContextMoqParam context.Context
IPNet *net.IPNet
}{
ContextMoqParam: contextMoqParam,
IPNet: iPNet,
}
mock.lockCreateNetworkIpRange.Lock()
mock.calls.CreateNetworkIpRange = append(mock.calls.CreateNetworkIpRange, callInfo)
mock.lockCreateNetworkIpRange.Unlock()
return mock.CreateNetworkIpRangeFunc(contextMoqParam, iPNet)
}
// CreateNetworkIpRangeCalls gets all the calls that were made to CreateNetworkIpRange.
// Check the length with:
//
// len(mockedNetworkManager.CreateNetworkIpRangeCalls())
func (mock *NetworkManagerMock) CreateNetworkIpRangeCalls() []struct {
ContextMoqParam context.Context
IPNet *net.IPNet
} {
var calls []struct {
ContextMoqParam context.Context
IPNet *net.IPNet
}
mock.lockCreateNetworkIpRange.RLock()
calls = mock.calls.CreateNetworkIpRange
mock.lockCreateNetworkIpRange.RUnlock()
return calls
}
// CreateNetworkService calls CreateNetworkServiceFunc.
func (mock *NetworkManagerMock) CreateNetworkService(contextMoqParam context.Context) (*servicenetworking.Connection, croType.StatusMessage, error) {
if mock.CreateNetworkServiceFunc == nil {
panic("NetworkManagerMock.CreateNetworkServiceFunc: method is nil but NetworkManager.CreateNetworkService was just called")
}
callInfo := struct {
ContextMoqParam context.Context
}{
ContextMoqParam: contextMoqParam,
}
mock.lockCreateNetworkService.Lock()
mock.calls.CreateNetworkService = append(mock.calls.CreateNetworkService, callInfo)
mock.lockCreateNetworkService.Unlock()
return mock.CreateNetworkServiceFunc(contextMoqParam)
}
// CreateNetworkServiceCalls gets all the calls that were made to CreateNetworkService.
// Check the length with:
//
// len(mockedNetworkManager.CreateNetworkServiceCalls())
func (mock *NetworkManagerMock) CreateNetworkServiceCalls() []struct {
ContextMoqParam context.Context
} {
var calls []struct {
ContextMoqParam context.Context
}
mock.lockCreateNetworkService.RLock()
calls = mock.calls.CreateNetworkService
mock.lockCreateNetworkService.RUnlock()
return calls
}
// DeleteNetworkIpRange calls DeleteNetworkIpRangeFunc.
func (mock *NetworkManagerMock) DeleteNetworkIpRange(contextMoqParam context.Context) error {
if mock.DeleteNetworkIpRangeFunc == nil {
panic("NetworkManagerMock.DeleteNetworkIpRangeFunc: method is nil but NetworkManager.DeleteNetworkIpRange was just called")
}
callInfo := struct {
ContextMoqParam context.Context
}{
ContextMoqParam: contextMoqParam,
}
mock.lockDeleteNetworkIpRange.Lock()
mock.calls.DeleteNetworkIpRange = append(mock.calls.DeleteNetworkIpRange, callInfo)
mock.lockDeleteNetworkIpRange.Unlock()
return mock.DeleteNetworkIpRangeFunc(contextMoqParam)
}
// DeleteNetworkIpRangeCalls gets all the calls that were made to DeleteNetworkIpRange.
// Check the length with:
//
// len(mockedNetworkManager.DeleteNetworkIpRangeCalls())
func (mock *NetworkManagerMock) DeleteNetworkIpRangeCalls() []struct {
ContextMoqParam context.Context
} {
var calls []struct {
ContextMoqParam context.Context
}
mock.lockDeleteNetworkIpRange.RLock()
calls = mock.calls.DeleteNetworkIpRange
mock.lockDeleteNetworkIpRange.RUnlock()
return calls
}
// DeleteNetworkPeering calls DeleteNetworkPeeringFunc.
func (mock *NetworkManagerMock) DeleteNetworkPeering(contextMoqParam context.Context) error {
if mock.DeleteNetworkPeeringFunc == nil {
panic("NetworkManagerMock.DeleteNetworkPeeringFunc: method is nil but NetworkManager.DeleteNetworkPeering was just called")
}
callInfo := struct {
ContextMoqParam context.Context
}{
ContextMoqParam: contextMoqParam,
}
mock.lockDeleteNetworkPeering.Lock()
mock.calls.DeleteNetworkPeering = append(mock.calls.DeleteNetworkPeering, callInfo)
mock.lockDeleteNetworkPeering.Unlock()
return mock.DeleteNetworkPeeringFunc(contextMoqParam)
}
// DeleteNetworkPeeringCalls gets all the calls that were made to DeleteNetworkPeering.
// Check the length with:
//
// len(mockedNetworkManager.DeleteNetworkPeeringCalls())
func (mock *NetworkManagerMock) DeleteNetworkPeeringCalls() []struct {
ContextMoqParam context.Context
} {
var calls []struct {
ContextMoqParam context.Context
}
mock.lockDeleteNetworkPeering.RLock()
calls = mock.calls.DeleteNetworkPeering
mock.lockDeleteNetworkPeering.RUnlock()
return calls
}
// DeleteNetworkService calls DeleteNetworkServiceFunc.
func (mock *NetworkManagerMock) DeleteNetworkService(contextMoqParam context.Context) error {
if mock.DeleteNetworkServiceFunc == nil {
panic("NetworkManagerMock.DeleteNetworkServiceFunc: method is nil but NetworkManager.DeleteNetworkService was just called")
}
callInfo := struct {
ContextMoqParam context.Context
}{
ContextMoqParam: contextMoqParam,
}
mock.lockDeleteNetworkService.Lock()
mock.calls.DeleteNetworkService = append(mock.calls.DeleteNetworkService, callInfo)
mock.lockDeleteNetworkService.Unlock()
return mock.DeleteNetworkServiceFunc(contextMoqParam)
}
// DeleteNetworkServiceCalls gets all the calls that were made to DeleteNetworkService.
// Check the length with:
//
// len(mockedNetworkManager.DeleteNetworkServiceCalls())
func (mock *NetworkManagerMock) DeleteNetworkServiceCalls() []struct {
ContextMoqParam context.Context
} {
var calls []struct {
ContextMoqParam context.Context
}
mock.lockDeleteNetworkService.RLock()
calls = mock.calls.DeleteNetworkService
mock.lockDeleteNetworkService.RUnlock()
return calls
}
// ReconcileNetworkProviderConfig calls ReconcileNetworkProviderConfigFunc.
func (mock *NetworkManagerMock) ReconcileNetworkProviderConfig(ctx context.Context, configManager ConfigManager, tier string) (*net.IPNet, error) {
if mock.ReconcileNetworkProviderConfigFunc == nil {
panic("NetworkManagerMock.ReconcileNetworkProviderConfigFunc: method is nil but NetworkManager.ReconcileNetworkProviderConfig was just called")
}
callInfo := struct {
Ctx context.Context
ConfigManager ConfigManager
Tier string
}{
Ctx: ctx,
ConfigManager: configManager,
Tier: tier,
}
mock.lockReconcileNetworkProviderConfig.Lock()
mock.calls.ReconcileNetworkProviderConfig = append(mock.calls.ReconcileNetworkProviderConfig, callInfo)
mock.lockReconcileNetworkProviderConfig.Unlock()
return mock.ReconcileNetworkProviderConfigFunc(ctx, configManager, tier)
}
// ReconcileNetworkProviderConfigCalls gets all the calls that were made to ReconcileNetworkProviderConfig.
// Check the length with:
//
// len(mockedNetworkManager.ReconcileNetworkProviderConfigCalls())
func (mock *NetworkManagerMock) ReconcileNetworkProviderConfigCalls() []struct {
Ctx context.Context
ConfigManager ConfigManager
Tier string
} {
var calls []struct {
Ctx context.Context
ConfigManager ConfigManager
Tier string
}
mock.lockReconcileNetworkProviderConfig.RLock()
calls = mock.calls.ReconcileNetworkProviderConfig
mock.lockReconcileNetworkProviderConfig.RUnlock()
return calls
}