| // Code generated by mockery v0.0.0-dev. DO NOT EDIT. |
| |
| package mocks |
| |
| import ( |
| context "context" |
| testing "testing" |
| |
| mock "github.com/stretchr/testify/mock" |
| |
| time "time" |
| |
| types "go.skia.org/infra/task_scheduler/go/types" |
| ) |
| |
| // TaskCache is an autogenerated mock type for the TaskCache type |
| type TaskCache struct { |
| mock.Mock |
| } |
| |
| // AddTasks provides a mock function with given fields: tasks |
| func (_m *TaskCache) AddTasks(tasks []*types.Task) { |
| _m.Called(tasks) |
| } |
| |
| // GetTask provides a mock function with given fields: id |
| func (_m *TaskCache) GetTask(id string) (*types.Task, error) { |
| ret := _m.Called(id) |
| |
| var r0 *types.Task |
| if rf, ok := ret.Get(0).(func(string) *types.Task); ok { |
| r0 = rf(id) |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).(*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func(string) error); ok { |
| r1 = rf(id) |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // GetTaskForCommit provides a mock function with given fields: repo, revision, name |
| func (_m *TaskCache) GetTaskForCommit(repo string, revision string, name string) (*types.Task, error) { |
| ret := _m.Called(repo, revision, name) |
| |
| var r0 *types.Task |
| if rf, ok := ret.Get(0).(func(string, string, string) *types.Task); ok { |
| r0 = rf(repo, revision, name) |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).(*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func(string, string, string) error); ok { |
| r1 = rf(repo, revision, name) |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // GetTaskMaybeExpired provides a mock function with given fields: _a0, _a1 |
| func (_m *TaskCache) GetTaskMaybeExpired(_a0 context.Context, _a1 string) (*types.Task, error) { |
| ret := _m.Called(_a0, _a1) |
| |
| var r0 *types.Task |
| if rf, ok := ret.Get(0).(func(context.Context, string) *types.Task); ok { |
| r0 = rf(_a0, _a1) |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).(*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { |
| r1 = rf(_a0, _a1) |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // GetTasksByKey provides a mock function with given fields: key |
| func (_m *TaskCache) GetTasksByKey(key types.TaskKey) ([]*types.Task, error) { |
| ret := _m.Called(key) |
| |
| var r0 []*types.Task |
| if rf, ok := ret.Get(0).(func(types.TaskKey) []*types.Task); ok { |
| r0 = rf(key) |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).([]*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func(types.TaskKey) error); ok { |
| r1 = rf(key) |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // GetTasksForCommits provides a mock function with given fields: repo, commits |
| func (_m *TaskCache) GetTasksForCommits(repo string, commits []string) (map[string]map[string]*types.Task, error) { |
| ret := _m.Called(repo, commits) |
| |
| var r0 map[string]map[string]*types.Task |
| if rf, ok := ret.Get(0).(func(string, []string) map[string]map[string]*types.Task); ok { |
| r0 = rf(repo, commits) |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).(map[string]map[string]*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func(string, []string) error); ok { |
| r1 = rf(repo, commits) |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // GetTasksFromDateRange provides a mock function with given fields: from, to |
| func (_m *TaskCache) GetTasksFromDateRange(from time.Time, to time.Time) ([]*types.Task, error) { |
| ret := _m.Called(from, to) |
| |
| var r0 []*types.Task |
| if rf, ok := ret.Get(0).(func(time.Time, time.Time) []*types.Task); ok { |
| r0 = rf(from, to) |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).([]*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func(time.Time, time.Time) error); ok { |
| r1 = rf(from, to) |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // KnownTaskName provides a mock function with given fields: repo, name |
| func (_m *TaskCache) KnownTaskName(repo string, name string) bool { |
| ret := _m.Called(repo, name) |
| |
| var r0 bool |
| if rf, ok := ret.Get(0).(func(string, string) bool); ok { |
| r0 = rf(repo, name) |
| } else { |
| r0 = ret.Get(0).(bool) |
| } |
| |
| return r0 |
| } |
| |
| // UnfinishedTasks provides a mock function with given fields: |
| func (_m *TaskCache) UnfinishedTasks() ([]*types.Task, error) { |
| ret := _m.Called() |
| |
| var r0 []*types.Task |
| if rf, ok := ret.Get(0).(func() []*types.Task); ok { |
| r0 = rf() |
| } else { |
| if ret.Get(0) != nil { |
| r0 = ret.Get(0).([]*types.Task) |
| } |
| } |
| |
| var r1 error |
| if rf, ok := ret.Get(1).(func() error); ok { |
| r1 = rf() |
| } else { |
| r1 = ret.Error(1) |
| } |
| |
| return r0, r1 |
| } |
| |
| // Update provides a mock function with given fields: ctx |
| func (_m *TaskCache) Update(ctx context.Context) error { |
| ret := _m.Called(ctx) |
| |
| var r0 error |
| if rf, ok := ret.Get(0).(func(context.Context) error); ok { |
| r0 = rf(ctx) |
| } else { |
| r0 = ret.Error(0) |
| } |
| |
| return r0 |
| } |
| |
| // NewTaskCache creates a new instance of TaskCache. It also registers a cleanup function to assert the mocks expectations. |
| func NewTaskCache(t testing.TB) *TaskCache { |
| mock := &TaskCache{} |
| |
| t.Cleanup(func() { mock.AssertExpectations(t) }) |
| |
| return mock |
| } |