-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathservice.go
More file actions
579 lines (468 loc) · 16.3 KB
/
Copy pathservice.go
File metadata and controls
579 lines (468 loc) · 16.3 KB
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
// Code generated by mockery v2.53.4. DO NOT EDIT.
package mocks
import (
context "context"
deploymentv1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
mock "github.com/stretchr/testify/mock"
rest "github.com/akash-network/akash-api/go/provider/client"
types "github.com/cosmos/cosmos-sdk/types"
v1 "github.com/akash-network/akash-api/go/provider/v1"
v1beta3 "github.com/akash-network/provider/cluster/types/v1beta3"
v1beta4 "github.com/akash-network/akash-api/go/node/market/v1beta4"
v2beta2 "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2"
)
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
type Service_Expecter struct {
mock *mock.Mock
}
func (_m *Service) EXPECT() *Service_Expecter {
return &Service_Expecter{mock: &_m.Mock}
}
// Close provides a mock function with no fields
func (_m *Service) Close() error {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Close")
}
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Service_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
type Service_Close_Call struct {
*mock.Call
}
// Close is a helper method to define mock.On call
func (_e *Service_Expecter) Close() *Service_Close_Call {
return &Service_Close_Call{Call: _e.mock.On("Close")}
}
func (_c *Service_Close_Call) Run(run func()) *Service_Close_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Service_Close_Call) Return(_a0 error) *Service_Close_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Service_Close_Call) RunAndReturn(run func() error) *Service_Close_Call {
_c.Call.Return(run)
return _c
}
// Done provides a mock function with no fields
func (_m *Service) Done() <-chan struct{} {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Done")
}
var r0 <-chan struct{}
if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan struct{})
}
}
return r0
}
// Service_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done'
type Service_Done_Call struct {
*mock.Call
}
// Done is a helper method to define mock.On call
func (_e *Service_Expecter) Done() *Service_Done_Call {
return &Service_Done_Call{Call: _e.mock.On("Done")}
}
func (_c *Service_Done_Call) Run(run func()) *Service_Done_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Service_Done_Call) Return(_a0 <-chan struct{}) *Service_Done_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Service_Done_Call) RunAndReturn(run func() <-chan struct{}) *Service_Done_Call {
_c.Call.Return(run)
return _c
}
// FindActiveLease provides a mock function with given fields: ctx, owner, dseq, gseq
func (_m *Service) FindActiveLease(ctx context.Context, owner types.Address, dseq uint64, gseq uint32) (bool, v1beta4.LeaseID, v2beta2.ManifestGroup, error) {
ret := _m.Called(ctx, owner, dseq, gseq)
if len(ret) == 0 {
panic("no return value specified for FindActiveLease")
}
var r0 bool
var r1 v1beta4.LeaseID
var r2 v2beta2.ManifestGroup
var r3 error
if rf, ok := ret.Get(0).(func(context.Context, types.Address, uint64, uint32) (bool, v1beta4.LeaseID, v2beta2.ManifestGroup, error)); ok {
return rf(ctx, owner, dseq, gseq)
}
if rf, ok := ret.Get(0).(func(context.Context, types.Address, uint64, uint32) bool); ok {
r0 = rf(ctx, owner, dseq, gseq)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, types.Address, uint64, uint32) v1beta4.LeaseID); ok {
r1 = rf(ctx, owner, dseq, gseq)
} else {
r1 = ret.Get(1).(v1beta4.LeaseID)
}
if rf, ok := ret.Get(2).(func(context.Context, types.Address, uint64, uint32) v2beta2.ManifestGroup); ok {
r2 = rf(ctx, owner, dseq, gseq)
} else {
r2 = ret.Get(2).(v2beta2.ManifestGroup)
}
if rf, ok := ret.Get(3).(func(context.Context, types.Address, uint64, uint32) error); ok {
r3 = rf(ctx, owner, dseq, gseq)
} else {
r3 = ret.Error(3)
}
return r0, r1, r2, r3
}
// Service_FindActiveLease_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindActiveLease'
type Service_FindActiveLease_Call struct {
*mock.Call
}
// FindActiveLease is a helper method to define mock.On call
// - ctx context.Context
// - owner types.Address
// - dseq uint64
// - gseq uint32
func (_e *Service_Expecter) FindActiveLease(ctx interface{}, owner interface{}, dseq interface{}, gseq interface{}) *Service_FindActiveLease_Call {
return &Service_FindActiveLease_Call{Call: _e.mock.On("FindActiveLease", ctx, owner, dseq, gseq)}
}
func (_c *Service_FindActiveLease_Call) Run(run func(ctx context.Context, owner types.Address, dseq uint64, gseq uint32)) *Service_FindActiveLease_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(types.Address), args[2].(uint64), args[3].(uint32))
})
return _c
}
func (_c *Service_FindActiveLease_Call) Return(_a0 bool, _a1 v1beta4.LeaseID, _a2 v2beta2.ManifestGroup, _a3 error) *Service_FindActiveLease_Call {
_c.Call.Return(_a0, _a1, _a2, _a3)
return _c
}
func (_c *Service_FindActiveLease_Call) RunAndReturn(run func(context.Context, types.Address, uint64, uint32) (bool, v1beta4.LeaseID, v2beta2.ManifestGroup, error)) *Service_FindActiveLease_Call {
_c.Call.Return(run)
return _c
}
// HostnameService provides a mock function with no fields
func (_m *Service) HostnameService() v1beta3.HostnameServiceClient {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for HostnameService")
}
var r0 v1beta3.HostnameServiceClient
if rf, ok := ret.Get(0).(func() v1beta3.HostnameServiceClient); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1beta3.HostnameServiceClient)
}
}
return r0
}
// Service_HostnameService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HostnameService'
type Service_HostnameService_Call struct {
*mock.Call
}
// HostnameService is a helper method to define mock.On call
func (_e *Service_Expecter) HostnameService() *Service_HostnameService_Call {
return &Service_HostnameService_Call{Call: _e.mock.On("HostnameService")}
}
func (_c *Service_HostnameService_Call) Run(run func()) *Service_HostnameService_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Service_HostnameService_Call) Return(_a0 v1beta3.HostnameServiceClient) *Service_HostnameService_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Service_HostnameService_Call) RunAndReturn(run func() v1beta3.HostnameServiceClient) *Service_HostnameService_Call {
_c.Call.Return(run)
return _c
}
// Ready provides a mock function with no fields
func (_m *Service) Ready() <-chan struct{} {
ret := _m.Called()
if len(ret) == 0 {
panic("no return value specified for Ready")
}
var r0 <-chan struct{}
if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan struct{})
}
}
return r0
}
// Service_Ready_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ready'
type Service_Ready_Call struct {
*mock.Call
}
// Ready is a helper method to define mock.On call
func (_e *Service_Expecter) Ready() *Service_Ready_Call {
return &Service_Ready_Call{Call: _e.mock.On("Ready")}
}
func (_c *Service_Ready_Call) Run(run func()) *Service_Ready_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Service_Ready_Call) Return(_a0 <-chan struct{}) *Service_Ready_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Service_Ready_Call) RunAndReturn(run func() <-chan struct{}) *Service_Ready_Call {
_c.Call.Return(run)
return _c
}
// Reserve provides a mock function with given fields: _a0, _a1
func (_m *Service) Reserve(_a0 v1beta4.OrderID, _a1 deploymentv1beta3.ResourceGroup) (v1beta3.Reservation, error) {
ret := _m.Called(_a0, _a1)
if len(ret) == 0 {
panic("no return value specified for Reserve")
}
var r0 v1beta3.Reservation
var r1 error
if rf, ok := ret.Get(0).(func(v1beta4.OrderID, deploymentv1beta3.ResourceGroup) (v1beta3.Reservation, error)); ok {
return rf(_a0, _a1)
}
if rf, ok := ret.Get(0).(func(v1beta4.OrderID, deploymentv1beta3.ResourceGroup) v1beta3.Reservation); ok {
r0 = rf(_a0, _a1)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(v1beta3.Reservation)
}
}
if rf, ok := ret.Get(1).(func(v1beta4.OrderID, deploymentv1beta3.ResourceGroup) error); ok {
r1 = rf(_a0, _a1)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Service_Reserve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Reserve'
type Service_Reserve_Call struct {
*mock.Call
}
// Reserve is a helper method to define mock.On call
// - _a0 v1beta4.OrderID
// - _a1 deploymentv1beta3.ResourceGroup
func (_e *Service_Expecter) Reserve(_a0 interface{}, _a1 interface{}) *Service_Reserve_Call {
return &Service_Reserve_Call{Call: _e.mock.On("Reserve", _a0, _a1)}
}
func (_c *Service_Reserve_Call) Run(run func(_a0 v1beta4.OrderID, _a1 deploymentv1beta3.ResourceGroup)) *Service_Reserve_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(v1beta4.OrderID), args[1].(deploymentv1beta3.ResourceGroup))
})
return _c
}
func (_c *Service_Reserve_Call) Return(_a0 v1beta3.Reservation, _a1 error) *Service_Reserve_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Service_Reserve_Call) RunAndReturn(run func(v1beta4.OrderID, deploymentv1beta3.ResourceGroup) (v1beta3.Reservation, error)) *Service_Reserve_Call {
_c.Call.Return(run)
return _c
}
// Status provides a mock function with given fields: _a0
func (_m *Service) Status(_a0 context.Context) (*rest.ClusterStatus, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Status")
}
var r0 *rest.ClusterStatus
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*rest.ClusterStatus, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(context.Context) *rest.ClusterStatus); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*rest.ClusterStatus)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Service_Status_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Status'
type Service_Status_Call struct {
*mock.Call
}
// Status is a helper method to define mock.On call
// - _a0 context.Context
func (_e *Service_Expecter) Status(_a0 interface{}) *Service_Status_Call {
return &Service_Status_Call{Call: _e.mock.On("Status", _a0)}
}
func (_c *Service_Status_Call) Run(run func(_a0 context.Context)) *Service_Status_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Service_Status_Call) Return(_a0 *rest.ClusterStatus, _a1 error) *Service_Status_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Service_Status_Call) RunAndReturn(run func(context.Context) (*rest.ClusterStatus, error)) *Service_Status_Call {
_c.Call.Return(run)
return _c
}
// StatusV1 provides a mock function with given fields: _a0
func (_m *Service) StatusV1(_a0 context.Context) (*v1.ClusterStatus, error) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for StatusV1")
}
var r0 *v1.ClusterStatus
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*v1.ClusterStatus, error)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(context.Context) *v1.ClusterStatus); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v1.ClusterStatus)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Service_StatusV1_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StatusV1'
type Service_StatusV1_Call struct {
*mock.Call
}
// StatusV1 is a helper method to define mock.On call
// - _a0 context.Context
func (_e *Service_Expecter) StatusV1(_a0 interface{}) *Service_StatusV1_Call {
return &Service_StatusV1_Call{Call: _e.mock.On("StatusV1", _a0)}
}
func (_c *Service_StatusV1_Call) Run(run func(_a0 context.Context)) *Service_StatusV1_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *Service_StatusV1_Call) Return(_a0 *v1.ClusterStatus, _a1 error) *Service_StatusV1_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *Service_StatusV1_Call) RunAndReturn(run func(context.Context) (*v1.ClusterStatus, error)) *Service_StatusV1_Call {
_c.Call.Return(run)
return _c
}
// TransferHostname provides a mock function with given fields: ctx, leaseID, hostname, serviceName, externalPort
func (_m *Service) TransferHostname(ctx context.Context, leaseID v1beta4.LeaseID, hostname string, serviceName string, externalPort uint32) error {
ret := _m.Called(ctx, leaseID, hostname, serviceName, externalPort)
if len(ret) == 0 {
panic("no return value specified for TransferHostname")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, v1beta4.LeaseID, string, string, uint32) error); ok {
r0 = rf(ctx, leaseID, hostname, serviceName, externalPort)
} else {
r0 = ret.Error(0)
}
return r0
}
// Service_TransferHostname_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransferHostname'
type Service_TransferHostname_Call struct {
*mock.Call
}
// TransferHostname is a helper method to define mock.On call
// - ctx context.Context
// - leaseID v1beta4.LeaseID
// - hostname string
// - serviceName string
// - externalPort uint32
func (_e *Service_Expecter) TransferHostname(ctx interface{}, leaseID interface{}, hostname interface{}, serviceName interface{}, externalPort interface{}) *Service_TransferHostname_Call {
return &Service_TransferHostname_Call{Call: _e.mock.On("TransferHostname", ctx, leaseID, hostname, serviceName, externalPort)}
}
func (_c *Service_TransferHostname_Call) Run(run func(ctx context.Context, leaseID v1beta4.LeaseID, hostname string, serviceName string, externalPort uint32)) *Service_TransferHostname_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(v1beta4.LeaseID), args[2].(string), args[3].(string), args[4].(uint32))
})
return _c
}
func (_c *Service_TransferHostname_Call) Return(_a0 error) *Service_TransferHostname_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Service_TransferHostname_Call) RunAndReturn(run func(context.Context, v1beta4.LeaseID, string, string, uint32) error) *Service_TransferHostname_Call {
_c.Call.Return(run)
return _c
}
// Unreserve provides a mock function with given fields: _a0
func (_m *Service) Unreserve(_a0 v1beta4.OrderID) error {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for Unreserve")
}
var r0 error
if rf, ok := ret.Get(0).(func(v1beta4.OrderID) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// Service_Unreserve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unreserve'
type Service_Unreserve_Call struct {
*mock.Call
}
// Unreserve is a helper method to define mock.On call
// - _a0 v1beta4.OrderID
func (_e *Service_Expecter) Unreserve(_a0 interface{}) *Service_Unreserve_Call {
return &Service_Unreserve_Call{Call: _e.mock.On("Unreserve", _a0)}
}
func (_c *Service_Unreserve_Call) Run(run func(_a0 v1beta4.OrderID)) *Service_Unreserve_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(v1beta4.OrderID))
})
return _c
}
func (_c *Service_Unreserve_Call) Return(_a0 error) *Service_Unreserve_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *Service_Unreserve_Call) RunAndReturn(run func(v1beta4.OrderID) error) *Service_Unreserve_Call {
_c.Call.Return(run)
return _c
}
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}