This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathtask_execution.go
75 lines (63 loc) · 2.59 KB
/
task_execution.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
package mocks
import (
"context"
"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/admin"
)
type CreateTaskExecutionEventFunc func(ctx context.Context, request admin.TaskExecutionEventRequest) (
*admin.TaskExecutionEventResponse, error)
type GetTaskExecutionFunc func(ctx context.Context, request admin.TaskExecutionGetRequest) (
*admin.TaskExecution, error)
type ListTaskExecutionsFunc func(ctx context.Context, request admin.TaskExecutionListRequest) (
*admin.TaskExecutionList, error)
type GetTaskExecutionDataFunc func(ctx context.Context, request admin.TaskExecutionGetDataRequest) (
*admin.TaskExecutionGetDataResponse, error)
type MockTaskExecutionManager struct {
createTaskExecutionEventFunc CreateTaskExecutionEventFunc
getTaskExecutionFunc GetTaskExecutionFunc
listTaskExecutionsFunc ListTaskExecutionsFunc
getTaskExecutionDataFunc GetTaskExecutionDataFunc
}
func (m *MockTaskExecutionManager) CreateTaskExecutionEvent(
ctx context.Context, request admin.TaskExecutionEventRequest) (*admin.TaskExecutionEventResponse, error) {
if m.createTaskExecutionEventFunc != nil {
return m.createTaskExecutionEventFunc(ctx, request)
}
return nil, nil
}
func (m *MockTaskExecutionManager) SetCreateTaskEventCallback(
createFunc CreateTaskExecutionEventFunc) {
m.createTaskExecutionEventFunc = createFunc
}
func (m *MockTaskExecutionManager) GetTaskExecution(
ctx context.Context, request admin.TaskExecutionGetRequest) (*admin.TaskExecution, error) {
if m.getTaskExecutionFunc != nil {
return m.getTaskExecutionFunc(ctx, request)
}
return nil, nil
}
func (m *MockTaskExecutionManager) SetGetTaskExecutionCallback(
getTaskExecutionFunc GetTaskExecutionFunc) {
m.getTaskExecutionFunc = getTaskExecutionFunc
}
func (m *MockTaskExecutionManager) ListTaskExecutions(
ctx context.Context, request admin.TaskExecutionListRequest) (*admin.TaskExecutionList, error) {
if m.listTaskExecutionsFunc != nil {
return m.listTaskExecutionsFunc(ctx, request)
}
return nil, nil
}
func (m *MockTaskExecutionManager) SetListTaskExecutionsCallback(
listTaskExecutionsFunc ListTaskExecutionsFunc) {
m.listTaskExecutionsFunc = listTaskExecutionsFunc
}
func (m *MockTaskExecutionManager) GetTaskExecutionData(
ctx context.Context, request admin.TaskExecutionGetDataRequest) (*admin.TaskExecutionGetDataResponse, error) {
if m.getTaskExecutionDataFunc != nil {
return m.getTaskExecutionDataFunc(ctx, request)
}
return nil, nil
}
func (m *MockTaskExecutionManager) SetGetTaskExecutionDataCallback(
getTaskExecutionDataFunc GetTaskExecutionDataFunc) {
m.getTaskExecutionDataFunc = getTaskExecutionDataFunc
}