forked from ShiningRush/fastflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_define_mock.go
458 lines (370 loc) · 9.99 KB
/
mod_define_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
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
package mod
import (
entity "github.com/etherealiy/fastflow/pkg/entity"
mock "github.com/stretchr/testify/mock"
)
// MockCloser is an autogenerated mock type for the Closer type
type MockCloser struct {
mock.Mock
}
// Close provides a mock function with given fields:
func (_m *MockCloser) Close() {
_m.Called()
}
// MockParser is an autogenerated mock type for the Parser type
type MockParser struct {
mock.Mock
}
// EntryTaskIns provides a mock function with given fields: taskIns
func (_m *MockParser) EntryTaskIns(taskIns *entity.TaskInstance) {
_m.Called(taskIns)
}
// InitialDagIns provides a mock function with given fields: dagIns
func (_m *MockParser) InitialDagIns(dagIns *entity.DagInstance) {
_m.Called(dagIns)
}
// MockExecutor is an autogenerated mock type for the Executor type
type MockExecutor struct {
mock.Mock
}
// CancelTaskIns provides a mock function with given fields: taskInsId
func (_m *MockExecutor) CancelTaskIns(taskInsId []string) error {
ret := _m.Called(taskInsId)
var r0 error
if rf, ok := ret.Get(0).(func([]string) error); ok {
r0 = rf(taskInsId)
} else {
r0 = ret.Error(0)
}
return r0
}
// Push provides a mock function with given fields: dagIns, taskIns
func (_m *MockExecutor) Push(data *entity.DagInstance, taskIns *entity.TaskInstance) {
_m.Called(data, taskIns)
}
// MockKeeper is an autogenerated mock type for the Keeper type
type MockKeeper struct {
mock.Mock
}
// AliveNodes provides a mock function with given fields:
func (_m *MockKeeper) AliveNodes() ([]string, error) {
ret := _m.Called()
var r0 []string
if rf, ok := ret.Get(0).(func() []string); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
func (_m *MockKeeper) IsAlive(workerKey string) (bool, error) {
ret := _m.Called(workerKey)
return ret.Bool(0), ret.Error(1)
}
// Close provides a mock function with given fields:
func (_m *MockKeeper) Close() {
_m.Called()
}
// IsLeader provides a mock function with given fields:
func (_m *MockKeeper) IsLeader() bool {
ret := _m.Called()
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// WorkerKey provides a mock function with given fields:
func (_m *MockKeeper) WorkerKey() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// WorkerNumber provides a mock function with given fields:
func (_m *MockKeeper) WorkerNumber() int {
ret := _m.Called()
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// NewMutex provides a mock function with given fields: key
func (_m *MockKeeper) NewMutex(key string) DistributedMutex {
ret := _m.Called(key)
var r0 DistributedMutex
if rf, ok := ret.Get(0).(func(string) DistributedMutex); ok {
r0 = rf(key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(DistributedMutex)
}
}
return r0
}
// MockStore is an autogenerated mock type for the Store type
type MockStore struct {
mock.Mock
}
// BatchCreatTaskIns provides a mock function with given fields: taskIns
func (_m *MockStore) BatchCreatTaskIns(taskIns []*entity.TaskInstance) error {
ret := _m.Called(taskIns)
var r0 error
if rf, ok := ret.Get(0).(func([]*entity.TaskInstance) error); ok {
r0 = rf(taskIns)
} else {
r0 = ret.Error(0)
}
return r0
}
// BatchUpdateDagIns provides a mock function with given fields: dagIns
func (_m *MockStore) BatchUpdateDagIns(dagIns []*entity.DagInstance) error {
ret := _m.Called(dagIns)
var r0 error
if rf, ok := ret.Get(0).(func([]*entity.DagInstance) error); ok {
r0 = rf(dagIns)
} else {
r0 = ret.Error(0)
}
return r0
}
// BatchUpdateTaskIns provides a mock function with given fields: taskIns
func (_m *MockStore) BatchUpdateTaskIns(taskIns []*entity.TaskInstance) error {
ret := _m.Called(taskIns)
var r0 error
if rf, ok := ret.Get(0).(func([]*entity.TaskInstance) error); ok {
r0 = rf(taskIns)
} else {
r0 = ret.Error(0)
}
return r0
}
// Close provides a mock function with given fields:
func (_m *MockStore) Close() {
_m.Called()
}
// CreateDag provides a mock function with given fields: dag
func (_m *MockStore) CreateDag(dag *entity.Dag) error {
ret := _m.Called(dag)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.Dag) error); ok {
r0 = rf(dag)
} else {
r0 = ret.Error(0)
}
return r0
}
// CreateDagIns provides a mock function with given fields: dagIns
func (_m *MockStore) CreateDagIns(dagIns *entity.DagInstance) error {
ret := _m.Called(dagIns)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.DagInstance) error); ok {
r0 = rf(dagIns)
} else {
r0 = ret.Error(0)
}
return r0
}
// GetDag provides a mock function with given fields: dagId
func (_m *MockStore) GetDag(dagId string) (*entity.Dag, error) {
ret := _m.Called(dagId)
var r0 *entity.Dag
if rf, ok := ret.Get(0).(func(string) *entity.Dag); ok {
r0 = rf(dagId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*entity.Dag)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(dagId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetDagInstance provides a mock function with given fields: dagInsId
func (_m *MockStore) GetDagInstance(dagInsId string) (*entity.DagInstance, error) {
ret := _m.Called(dagInsId)
var r0 *entity.DagInstance
if rf, ok := ret.Get(0).(func(string) *entity.DagInstance); ok {
r0 = rf(dagInsId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*entity.DagInstance)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(dagInsId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTaskIns provides a mock function with given fields: taskIns
func (_m *MockStore) GetTaskIns(taskIns string) (*entity.TaskInstance, error) {
ret := _m.Called(taskIns)
var r0 *entity.TaskInstance
if rf, ok := ret.Get(0).(func(string) *entity.TaskInstance); ok {
r0 = rf(taskIns)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*entity.TaskInstance)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(taskIns)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListDagInstance provides a mock function with given fields: input
func (_m *MockStore) ListDagInstance(input *ListDagInstanceInput) ([]*entity.DagInstance, error) {
ret := _m.Called(input)
var r0 []*entity.DagInstance
if rf, ok := ret.Get(0).(func(*ListDagInstanceInput) []*entity.DagInstance); ok {
r0 = rf(input)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*entity.DagInstance)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*ListDagInstanceInput) error); ok {
r1 = rf(input)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListTaskInstance provides a mock function with given fields: input
func (_m *MockStore) ListTaskInstance(input *ListTaskInstanceInput) ([]*entity.TaskInstance, error) {
ret := _m.Called(input)
var r0 []*entity.TaskInstance
if rf, ok := ret.Get(0).(func(*ListTaskInstanceInput) []*entity.TaskInstance); ok {
r0 = rf(input)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*entity.TaskInstance)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*ListTaskInstanceInput) error); ok {
r1 = rf(input)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PatchTaskIns provides a mock function with given fields: taskIns
func (_m *MockStore) PatchTaskIns(taskIns *entity.TaskInstance) error {
ret := _m.Called(taskIns)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.TaskInstance) error); ok {
r0 = rf(taskIns)
} else {
r0 = ret.Error(0)
}
return r0
}
// PatchDagIns provides a mock function with given fields: dagIns, mustsPatchFields
func (_m *MockStore) PatchDagIns(dagIns *entity.DagInstance, mustsPatchFields ...string) error {
_va := make([]interface{}, len(mustsPatchFields))
for _i := range mustsPatchFields {
_va[_i] = mustsPatchFields[_i]
}
var _ca []interface{}
_ca = append(_ca, dagIns)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.DagInstance, ...string) error); ok {
r0 = rf(dagIns, mustsPatchFields...)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateDagIns provides a mock function with given fields: dagIns
func (_m *MockStore) UpdateDag(dag *entity.Dag) error {
ret := _m.Called(dag)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.Dag) error); ok {
r0 = rf(dag)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateDagIns provides a mock function with given fields: dagIns
func (_m *MockStore) UpdateDagIns(dagIns *entity.DagInstance) error {
ret := _m.Called(dagIns)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.DagInstance) error); ok {
r0 = rf(dagIns)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateTaskIns provides a mock function with given fields: taskIns
func (_m *MockStore) UpdateTaskIns(taskIns *entity.TaskInstance) error {
ret := _m.Called(taskIns)
var r0 error
if rf, ok := ret.Get(0).(func(*entity.TaskInstance) error); ok {
r0 = rf(taskIns)
} else {
r0 = ret.Error(0)
}
return r0
}
func (_m *MockStore) Marshal(obj interface{}) ([]byte, error) {
ret := _m.Called(obj)
return ret.Get(0).([]byte), ret.Error(1)
}
func (_m *MockStore) Unmarshal(bytes []byte, ptr interface{}) error {
ret := _m.Called(bytes, ptr)
return ret.Error(0)
}
type MockTaskInfoGetter struct {
ID string
Depend []string
Status entity.TaskInstanceStatus
}
// GetDepend provides a mock function with given fields:
func (_m *MockTaskInfoGetter) GetDepend() []string {
return _m.Depend
}
// GetGraphID provides a mock function with given fields:
func (_m *MockTaskInfoGetter) GetGraphID() string {
return _m.ID
}
// GetID provides a mock function with given fields:
func (_m *MockTaskInfoGetter) GetID() string {
return _m.ID
}
// GetStatus provides a mock function with given fields:
func (_m *MockTaskInfoGetter) GetStatus() entity.TaskInstanceStatus {
return _m.Status
}