Documentation
¶
Index ¶
- type JobServiceMock
- func (mock *JobServiceMock) ClaimJob(ctx context.Context) (*domain.Job, error)
- func (mock *JobServiceMock) ClaimJobCalls() []struct{ ... }
- func (mock *JobServiceMock) ClaimTask(ctx context.Context) (*domain.Task, error)
- func (mock *JobServiceMock) ClaimTaskCalls() []struct{ ... }
- func (mock *JobServiceMock) CountEventsByJobID(ctx context.Context, jobID string) (int, error)
- func (mock *JobServiceMock) CountEventsByJobIDCalls() []struct{ ... }
- func (mock *JobServiceMock) CountTasksByJobID(ctx context.Context, jobID string) (int, error)
- func (mock *JobServiceMock) CountTasksByJobIDCalls() []struct{ ... }
- func (mock *JobServiceMock) CreateEvent(ctx context.Context, jobID string, event *domain.Event) (*domain.Event, error)
- func (mock *JobServiceMock) CreateEventCalls() []struct{ ... }
- func (mock *JobServiceMock) CreateJob(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error)
- func (mock *JobServiceMock) CreateJobCalls() []struct{ ... }
- func (mock *JobServiceMock) CreateTask(ctx context.Context, jobID string, task *domain.Task) (*domain.Task, error)
- func (mock *JobServiceMock) CreateTaskCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJob(ctx context.Context, jobID string) (*domain.Job, error)
- func (mock *JobServiceMock) GetJobCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJobEvents(ctx context.Context, jobID string, limit int, offset int) ([]*domain.Event, int, error)
- func (mock *JobServiceMock) GetJobEventsCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJobTasks(ctx context.Context, states []domain.TaskState, jobID string, limit int, ...) ([]*domain.Task, int, error)
- func (mock *JobServiceMock) GetJobTasksCalls() []struct{ ... }
- func (mock *JobServiceMock) GetJobs(ctx context.Context, states []domain.JobState, limit int, offset int) ([]*domain.Job, int, error)
- func (mock *JobServiceMock) GetJobsCalls() []struct{ ... }
- func (mock *JobServiceMock) UpdateJobState(ctx context.Context, jobID string, newState domain.JobState) error
- func (mock *JobServiceMock) UpdateJobStateCalls() []struct{ ... }
- func (mock *JobServiceMock) UpdateTask(ctx context.Context, task *domain.Task) error
- func (mock *JobServiceMock) UpdateTaskCalls() []struct{ ... }
- func (mock *JobServiceMock) UpdateTaskState(ctx context.Context, taskID string, newState domain.TaskState) error
- func (mock *JobServiceMock) UpdateTaskStateCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobServiceMock ¶
type JobServiceMock struct {
// ClaimJobFunc mocks the ClaimJob method.
ClaimJobFunc func(ctx context.Context) (*domain.Job, error)
// ClaimTaskFunc mocks the ClaimTask method.
ClaimTaskFunc func(ctx context.Context) (*domain.Task, error)
// CountEventsByJobIDFunc mocks the CountEventsByJobID method.
CountEventsByJobIDFunc func(ctx context.Context, jobID string) (int, error)
// CountTasksByJobIDFunc mocks the CountTasksByJobID method.
CountTasksByJobIDFunc func(ctx context.Context, jobID string) (int, error)
// CreateEventFunc mocks the CreateEvent method.
CreateEventFunc func(ctx context.Context, jobID string, event *domain.Event) (*domain.Event, error)
// CreateJobFunc mocks the CreateJob method.
CreateJobFunc func(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error)
// CreateTaskFunc mocks the CreateTask method.
CreateTaskFunc func(ctx context.Context, jobID string, task *domain.Task) (*domain.Task, error)
// GetJobFunc mocks the GetJob method.
GetJobFunc func(ctx context.Context, jobID string) (*domain.Job, error)
// GetJobEventsFunc mocks the GetJobEvents method.
GetJobEventsFunc func(ctx context.Context, jobID string, limit int, offset int) ([]*domain.Event, int, error)
// GetJobTasksFunc mocks the GetJobTasks method.
GetJobTasksFunc func(ctx context.Context, states []domain.TaskState, jobID string, limit int, offset int) ([]*domain.Task, int, error)
// GetJobsFunc mocks the GetJobs method.
GetJobsFunc func(ctx context.Context, states []domain.JobState, limit int, offset int) ([]*domain.Job, int, error)
// UpdateJobStateFunc mocks the UpdateJobState method.
UpdateJobStateFunc func(ctx context.Context, jobID string, newState domain.JobState) error
// UpdateTaskFunc mocks the UpdateTask method.
UpdateTaskFunc func(ctx context.Context, task *domain.Task) error
// UpdateTaskStateFunc mocks the UpdateTaskState method.
UpdateTaskStateFunc func(ctx context.Context, taskID string, newState domain.TaskState) error
// contains filtered or unexported fields
}
JobServiceMock is a mock implementation of application.JobService.
func TestSomethingThatUsesJobService(t *testing.T) {
// make and configure a mocked application.JobService
mockedJobService := &JobServiceMock{
ClaimJobFunc: func(ctx context.Context) (*domain.Job, error) {
panic("mock out the ClaimJob method")
},
ClaimTaskFunc: func(ctx context.Context) (*domain.Task, error) {
panic("mock out the ClaimTask method")
},
CountEventsByJobIDFunc: func(ctx context.Context, jobID string) (int, error) {
panic("mock out the CountEventsByJobID method")
},
CountTasksByJobIDFunc: func(ctx context.Context, jobID string) (int, error) {
panic("mock out the CountTasksByJobID method")
},
CreateEventFunc: func(ctx context.Context, jobID string, event *domain.Event) (*domain.Event, error) {
panic("mock out the CreateEvent method")
},
CreateJobFunc: func(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error) {
panic("mock out the CreateJob method")
},
CreateTaskFunc: func(ctx context.Context, jobID string, task *domain.Task) (*domain.Task, error) {
panic("mock out the CreateTask method")
},
GetJobFunc: func(ctx context.Context, jobID string) (*domain.Job, error) {
panic("mock out the GetJob method")
},
GetJobEventsFunc: func(ctx context.Context, jobID string, limit int, offset int) ([]*domain.Event, int, error) {
panic("mock out the GetJobEvents method")
},
GetJobTasksFunc: func(ctx context.Context, states []domain.TaskState, jobID string, limit int, offset int) ([]*domain.Task, int, error) {
panic("mock out the GetJobTasks method")
},
GetJobsFunc: func(ctx context.Context, states []domain.JobState, limit int, offset int) ([]*domain.Job, int, error) {
panic("mock out the GetJobs method")
},
UpdateJobStateFunc: func(ctx context.Context, jobID string, newState domain.JobState) error {
panic("mock out the UpdateJobState method")
},
UpdateTaskFunc: func(ctx context.Context, task *domain.Task) error {
panic("mock out the UpdateTask method")
},
UpdateTaskStateFunc: func(ctx context.Context, taskID string, newState domain.TaskState) error {
panic("mock out the UpdateTaskState method")
},
}
// use mockedJobService in code that requires application.JobService
// and then make assertions.
}
func (*JobServiceMock) ClaimJobCalls ¶ added in v0.15.0
func (mock *JobServiceMock) ClaimJobCalls() []struct { Ctx context.Context }
ClaimJobCalls gets all the calls that were made to ClaimJob. Check the length with:
len(mockedJobService.ClaimJobCalls())
func (*JobServiceMock) ClaimTaskCalls ¶ added in v0.15.0
func (mock *JobServiceMock) ClaimTaskCalls() []struct { Ctx context.Context }
ClaimTaskCalls gets all the calls that were made to ClaimTask. Check the length with:
len(mockedJobService.ClaimTaskCalls())
func (*JobServiceMock) CountEventsByJobID ¶ added in v0.12.0
CountEventsByJobID calls CountEventsByJobIDFunc.
func (*JobServiceMock) CountEventsByJobIDCalls ¶ added in v0.12.0
func (mock *JobServiceMock) CountEventsByJobIDCalls() []struct { Ctx context.Context JobID string }
CountEventsByJobIDCalls gets all the calls that were made to CountEventsByJobID. Check the length with:
len(mockedJobService.CountEventsByJobIDCalls())
func (*JobServiceMock) CountTasksByJobID ¶ added in v0.11.0
CountTasksByJobID calls CountTasksByJobIDFunc.
func (*JobServiceMock) CountTasksByJobIDCalls ¶ added in v0.11.0
func (mock *JobServiceMock) CountTasksByJobIDCalls() []struct { Ctx context.Context JobID string }
CountTasksByJobIDCalls gets all the calls that were made to CountTasksByJobID. Check the length with:
len(mockedJobService.CountTasksByJobIDCalls())
func (*JobServiceMock) CreateEvent ¶ added in v0.12.0
func (mock *JobServiceMock) CreateEvent(ctx context.Context, jobID string, event *domain.Event) (*domain.Event, error)
CreateEvent calls CreateEventFunc.
func (*JobServiceMock) CreateEventCalls ¶ added in v0.12.0
func (mock *JobServiceMock) CreateEventCalls() []struct { Ctx context.Context JobID string Event *domain.Event }
CreateEventCalls gets all the calls that were made to CreateEvent. Check the length with:
len(mockedJobService.CreateEventCalls())
func (*JobServiceMock) CreateJob ¶
func (mock *JobServiceMock) CreateJob(ctx context.Context, jobConfig *domain.JobConfig) (*domain.Job, error)
CreateJob calls CreateJobFunc.
func (*JobServiceMock) CreateJobCalls ¶
func (mock *JobServiceMock) CreateJobCalls() []struct { Ctx context.Context JobConfig *domain.JobConfig }
CreateJobCalls gets all the calls that were made to CreateJob. Check the length with:
len(mockedJobService.CreateJobCalls())
func (*JobServiceMock) CreateTask ¶ added in v0.12.0
func (mock *JobServiceMock) CreateTask(ctx context.Context, jobID string, task *domain.Task) (*domain.Task, error)
CreateTask calls CreateTaskFunc.
func (*JobServiceMock) CreateTaskCalls ¶ added in v0.12.0
func (mock *JobServiceMock) CreateTaskCalls() []struct { Ctx context.Context JobID string Task *domain.Task }
CreateTaskCalls gets all the calls that were made to CreateTask. Check the length with:
len(mockedJobService.CreateTaskCalls())
func (*JobServiceMock) GetJobCalls ¶
func (mock *JobServiceMock) GetJobCalls() []struct { Ctx context.Context JobID string }
GetJobCalls gets all the calls that were made to GetJob. Check the length with:
len(mockedJobService.GetJobCalls())
func (*JobServiceMock) GetJobEvents ¶ added in v0.12.0
func (mock *JobServiceMock) GetJobEvents(ctx context.Context, jobID string, limit int, offset int) ([]*domain.Event, int, error)
GetJobEvents calls GetJobEventsFunc.
func (*JobServiceMock) GetJobEventsCalls ¶ added in v0.12.0
func (mock *JobServiceMock) GetJobEventsCalls() []struct { Ctx context.Context JobID string Limit int Offset int }
GetJobEventsCalls gets all the calls that were made to GetJobEvents. Check the length with:
len(mockedJobService.GetJobEventsCalls())
func (*JobServiceMock) GetJobTasks ¶ added in v0.11.0
func (mock *JobServiceMock) GetJobTasks(ctx context.Context, states []domain.TaskState, jobID string, limit int, offset int) ([]*domain.Task, int, error)
GetJobTasks calls GetJobTasksFunc.
func (*JobServiceMock) GetJobTasksCalls ¶ added in v0.11.0
func (mock *JobServiceMock) GetJobTasksCalls() []struct { Ctx context.Context States []domain.TaskState JobID string Limit int Offset int }
GetJobTasksCalls gets all the calls that were made to GetJobTasks. Check the length with:
len(mockedJobService.GetJobTasksCalls())
func (*JobServiceMock) GetJobs ¶ added in v0.10.0
func (mock *JobServiceMock) GetJobs(ctx context.Context, states []domain.JobState, limit int, offset int) ([]*domain.Job, int, error)
GetJobs calls GetJobsFunc.
func (*JobServiceMock) GetJobsCalls ¶ added in v0.10.0
func (mock *JobServiceMock) GetJobsCalls() []struct { Ctx context.Context States []domain.JobState Limit int Offset int }
GetJobsCalls gets all the calls that were made to GetJobs. Check the length with:
len(mockedJobService.GetJobsCalls())
func (*JobServiceMock) UpdateJobState ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateJobState(ctx context.Context, jobID string, newState domain.JobState) error
UpdateJobState calls UpdateJobStateFunc.
func (*JobServiceMock) UpdateJobStateCalls ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateJobStateCalls() []struct { Ctx context.Context JobID string NewState domain.JobState }
UpdateJobStateCalls gets all the calls that were made to UpdateJobState. Check the length with:
len(mockedJobService.UpdateJobStateCalls())
func (*JobServiceMock) UpdateTask ¶ added in v0.15.0
UpdateTask calls UpdateTaskFunc.
func (*JobServiceMock) UpdateTaskCalls ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateTaskCalls() []struct { Ctx context.Context Task *domain.Task }
UpdateTaskCalls gets all the calls that were made to UpdateTask. Check the length with:
len(mockedJobService.UpdateTaskCalls())
func (*JobServiceMock) UpdateTaskState ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateTaskState(ctx context.Context, taskID string, newState domain.TaskState) error
UpdateTaskState calls UpdateTaskStateFunc.
func (*JobServiceMock) UpdateTaskStateCalls ¶ added in v0.15.0
func (mock *JobServiceMock) UpdateTaskStateCalls() []struct { Ctx context.Context TaskID string NewState domain.TaskState }
UpdateTaskStateCalls gets all the calls that were made to UpdateTaskState. Check the length with:
len(mockedJobService.UpdateTaskStateCalls())