Documentation ¶
Index ¶
- type AuthHandlerMock
- type DataStorerMock
- func (mock *DataStorerMock) AcquireJobLock(ctx context.Context, id string) (string, error)
- func (mock *DataStorerMock) AcquireJobLockCalls() []struct{ ... }
- func (mock *DataStorerMock) CheckInProgressJob(ctx context.Context, cfg *config.Config) error
- func (mock *DataStorerMock) CheckInProgressJobCalls() []struct{ ... }
- func (mock *DataStorerMock) CreateJob(ctx context.Context, job models.Job) error
- func (mock *DataStorerMock) CreateJobCalls() []struct{ ... }
- func (mock *DataStorerMock) GetJob(ctx context.Context, id string) (*models.Job, error)
- func (mock *DataStorerMock) GetJobCalls() []struct{ ... }
- func (mock *DataStorerMock) GetJobs(ctx context.Context, options mongo.Options) (*models.Jobs, error)
- func (mock *DataStorerMock) GetJobsCalls() []struct{ ... }
- func (mock *DataStorerMock) GetTask(ctx context.Context, jobID string, taskName string) (*models.Task, error)
- func (mock *DataStorerMock) GetTaskCalls() []struct{ ... }
- func (mock *DataStorerMock) GetTasks(ctx context.Context, jobID string, options mongo.Options) (*models.Tasks, error)
- func (mock *DataStorerMock) GetTasksCalls() []struct{ ... }
- func (mock *DataStorerMock) UnlockJob(ctx context.Context, lockID string)
- func (mock *DataStorerMock) UnlockJobCalls() []struct{ ... }
- func (mock *DataStorerMock) UpdateJob(ctx context.Context, id string, updates primitive.M) error
- func (mock *DataStorerMock) UpdateJobCalls() []struct{ ... }
- func (mock *DataStorerMock) UpsertTask(ctx context.Context, jobID string, taskName string, task models.Task) error
- func (mock *DataStorerMock) UpsertTaskCalls() []struct{ ... }
- type IndexerMock
- func (mock *IndexerMock) CreateIndex(ctx context.Context, serviceAuthToken string, searchAPISearchURL string, ...) (*http.Response, error)
- func (mock *IndexerMock) CreateIndexCalls() []struct{ ... }
- func (mock *IndexerMock) GetIndexNameFromResponse(ctx context.Context, body io.ReadCloser) (string, error)
- func (mock *IndexerMock) GetIndexNameFromResponseCalls() []struct{ ... }
- func (mock *IndexerMock) SendReindexRequestedEvent(cfg *config.Config, jobID string, indexName string) error
- func (mock *IndexerMock) SendReindexRequestedEventCalls() []struct{ ... }
- type ReindexRequestedProducerMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandlerMock ¶ added in v0.9.0
type AuthHandlerMock struct { // RequireFunc mocks the Require method. RequireFunc func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc // contains filtered or unexported fields }
AuthHandlerMock is a mock implementation of api.AuthHandler.
func TestSomethingThatUsesAuthHandler(t *testing.T) { // make and configure a mocked api.AuthHandler mockedAuthHandler := &AuthHandlerMock{ RequireFunc: func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc { panic("mock out the Require method") }, } // use mockedAuthHandler in code that requires api.AuthHandler // and then make assertions. }
func (*AuthHandlerMock) Require ¶ added in v0.9.0
func (mock *AuthHandlerMock) Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
Require calls RequireFunc.
func (*AuthHandlerMock) RequireCalls ¶ added in v0.9.0
func (mock *AuthHandlerMock) RequireCalls() []struct { Required auth.Permissions Handler http.HandlerFunc }
RequireCalls gets all the calls that were made to Require. Check the length with:
len(mockedAuthHandler.RequireCalls())
type DataStorerMock ¶ added in v0.11.0
type DataStorerMock struct { // AcquireJobLockFunc mocks the AcquireJobLock method. AcquireJobLockFunc func(ctx context.Context, id string) (string, error) // CheckInProgressJobFunc mocks the CheckInProgressJob method. CheckInProgressJobFunc func(ctx context.Context, cfg *config.Config) error // CreateJobFunc mocks the CreateJob method. CreateJobFunc func(ctx context.Context, job models.Job) error // GetJobFunc mocks the GetJob method. GetJobFunc func(ctx context.Context, id string) (*models.Job, error) // GetJobsFunc mocks the GetJobs method. GetJobsFunc func(ctx context.Context, options mongo.Options) (*models.Jobs, error) // GetTaskFunc mocks the GetTask method. GetTaskFunc func(ctx context.Context, jobID string, taskName string) (*models.Task, error) // GetTasksFunc mocks the GetTasks method. GetTasksFunc func(ctx context.Context, jobID string, options mongo.Options) (*models.Tasks, error) // UnlockJobFunc mocks the UnlockJob method. UnlockJobFunc func(ctx context.Context, lockID string) // UpdateJobFunc mocks the UpdateJob method. UpdateJobFunc func(ctx context.Context, id string, updates primitive.M) error // UpsertTaskFunc mocks the UpsertTask method. UpsertTaskFunc func(ctx context.Context, jobID string, taskName string, task models.Task) error // contains filtered or unexported fields }
DataStorerMock is a mock implementation of api.DataStorer.
func TestSomethingThatUsesDataStorer(t *testing.T) { // make and configure a mocked api.DataStorer mockedDataStorer := &DataStorerMock{ AcquireJobLockFunc: func(ctx context.Context, id string) (string, error) { panic("mock out the AcquireJobLock method") }, CheckInProgressJobFunc: func(ctx context.Context, cfg *config.Config) error { panic("mock out the CheckInProgressJob method") }, CreateJobFunc: func(ctx context.Context, job models.Job) error { panic("mock out the CreateJob method") }, GetJobFunc: func(ctx context.Context, id string) (*models.Job, error) { panic("mock out the GetJob method") }, GetJobsFunc: func(ctx context.Context, options mongo.Options) (*models.Jobs, error) { panic("mock out the GetJobs method") }, GetTaskFunc: func(ctx context.Context, jobID string, taskName string) (*models.Task, error) { panic("mock out the GetTask method") }, GetTasksFunc: func(ctx context.Context, jobID string, options mongo.Options) (*models.Tasks, error) { panic("mock out the GetTasks method") }, UnlockJobFunc: func(ctx context.Context, lockID string) { panic("mock out the UnlockJob method") }, UpdateJobFunc: func(ctx context.Context, id string, updates primitive.M) error { panic("mock out the UpdateJob method") }, UpsertTaskFunc: func(ctx context.Context, jobID string, taskName string, task models.Task) error { panic("mock out the UpsertTask method") }, } // use mockedDataStorer in code that requires api.DataStorer // and then make assertions. }
func (*DataStorerMock) AcquireJobLock ¶ added in v0.11.0
AcquireJobLock calls AcquireJobLockFunc.
func (*DataStorerMock) AcquireJobLockCalls ¶ added in v0.11.0
func (mock *DataStorerMock) AcquireJobLockCalls() []struct { Ctx context.Context ID string }
AcquireJobLockCalls gets all the calls that were made to AcquireJobLock. Check the length with:
len(mockedDataStorer.AcquireJobLockCalls())
func (*DataStorerMock) CheckInProgressJob ¶ added in v0.21.0
CheckInProgressJob calls CheckInProgressJobFunc.
func (*DataStorerMock) CheckInProgressJobCalls ¶ added in v0.21.0
func (mock *DataStorerMock) CheckInProgressJobCalls() []struct { Ctx context.Context Cfg *config.Config }
CheckInProgressJobCalls gets all the calls that were made to CheckInProgressJob. Check the length with:
len(mockedDataStorer.CheckInProgressJobCalls())
func (*DataStorerMock) CreateJobCalls ¶ added in v0.11.0
func (mock *DataStorerMock) CreateJobCalls() []struct { Ctx context.Context Job models.Job }
CreateJobCalls gets all the calls that were made to CreateJob. Check the length with:
len(mockedDataStorer.CreateJobCalls())
func (*DataStorerMock) GetJobCalls ¶ added in v0.11.0
func (mock *DataStorerMock) GetJobCalls() []struct { Ctx context.Context ID string }
GetJobCalls gets all the calls that were made to GetJob. Check the length with:
len(mockedDataStorer.GetJobCalls())
func (*DataStorerMock) GetJobs ¶ added in v0.11.0
func (mock *DataStorerMock) GetJobs(ctx context.Context, options mongo.Options) (*models.Jobs, error)
GetJobs calls GetJobsFunc.
func (*DataStorerMock) GetJobsCalls ¶ added in v0.11.0
func (mock *DataStorerMock) GetJobsCalls() []struct { Ctx context.Context Options mongo.Options }
GetJobsCalls gets all the calls that were made to GetJobs. Check the length with:
len(mockedDataStorer.GetJobsCalls())
func (*DataStorerMock) GetTask ¶ added in v0.11.0
func (mock *DataStorerMock) GetTask(ctx context.Context, jobID string, taskName string) (*models.Task, error)
GetTask calls GetTaskFunc.
func (*DataStorerMock) GetTaskCalls ¶ added in v0.11.0
func (mock *DataStorerMock) GetTaskCalls() []struct { Ctx context.Context JobID string TaskName string }
GetTaskCalls gets all the calls that were made to GetTask. Check the length with:
len(mockedDataStorer.GetTaskCalls())
func (*DataStorerMock) GetTasks ¶ added in v0.12.0
func (mock *DataStorerMock) GetTasks(ctx context.Context, jobID string, options mongo.Options) (*models.Tasks, error)
GetTasks calls GetTasksFunc.
func (*DataStorerMock) GetTasksCalls ¶ added in v0.12.0
func (mock *DataStorerMock) GetTasksCalls() []struct { Ctx context.Context JobID string Options mongo.Options }
GetTasksCalls gets all the calls that were made to GetTasks. Check the length with:
len(mockedDataStorer.GetTasksCalls())
func (*DataStorerMock) UnlockJob ¶ added in v0.11.0
func (mock *DataStorerMock) UnlockJob(ctx context.Context, lockID string)
UnlockJob calls UnlockJobFunc.
func (*DataStorerMock) UnlockJobCalls ¶ added in v0.11.0
func (mock *DataStorerMock) UnlockJobCalls() []struct { Ctx context.Context LockID string }
UnlockJobCalls gets all the calls that were made to UnlockJob. Check the length with:
len(mockedDataStorer.UnlockJobCalls())
func (*DataStorerMock) UpdateJobCalls ¶ added in v0.21.0
func (mock *DataStorerMock) UpdateJobCalls() []struct { Ctx context.Context ID string Updates primitive.M }
UpdateJobCalls gets all the calls that were made to UpdateJob. Check the length with:
len(mockedDataStorer.UpdateJobCalls())
func (*DataStorerMock) UpsertTask ¶ added in v0.21.0
func (mock *DataStorerMock) UpsertTask(ctx context.Context, jobID string, taskName string, task models.Task) error
UpsertTask calls UpsertTaskFunc.
func (*DataStorerMock) UpsertTaskCalls ¶ added in v0.21.0
func (mock *DataStorerMock) UpsertTaskCalls() []struct { Ctx context.Context JobID string TaskName string Task models.Task }
UpsertTaskCalls gets all the calls that were made to UpsertTask. Check the length with:
len(mockedDataStorer.UpsertTaskCalls())
type IndexerMock ¶ added in v0.14.0
type IndexerMock struct { // CreateIndexFunc mocks the CreateIndex method. CreateIndexFunc func(ctx context.Context, serviceAuthToken string, searchAPISearchURL string, httpClient dpHTTP.Clienter) (*http.Response, error) // GetIndexNameFromResponseFunc mocks the GetIndexNameFromResponse method. GetIndexNameFromResponseFunc func(ctx context.Context, body io.ReadCloser) (string, error) // SendReindexRequestedEventFunc mocks the SendReindexRequestedEvent method. SendReindexRequestedEventFunc func(cfg *config.Config, jobID string, indexName string) error // contains filtered or unexported fields }
IndexerMock is a mock implementation of api.Indexer.
func TestSomethingThatUsesIndexer(t *testing.T) { // make and configure a mocked api.Indexer mockedIndexer := &IndexerMock{ CreateIndexFunc: func(ctx context.Context, serviceAuthToken string, searchAPISearchURL string, httpClient dpHTTP.Clienter) (*http.Response, error) { panic("mock out the CreateIndex method") }, GetIndexNameFromResponseFunc: func(ctx context.Context, body io.ReadCloser) (string, error) { panic("mock out the GetIndexNameFromResponse method") }, SendReindexRequestedEventFunc: func(cfg *config.Config, jobID string, indexName string) error { panic("mock out the SendReindexRequestedEvent method") }, } // use mockedIndexer in code that requires api.Indexer // and then make assertions. }
func (*IndexerMock) CreateIndex ¶ added in v0.14.0
func (mock *IndexerMock) CreateIndex(ctx context.Context, serviceAuthToken string, searchAPISearchURL string, httpClient dpHTTP.Clienter) (*http.Response, error)
CreateIndex calls CreateIndexFunc.
func (*IndexerMock) CreateIndexCalls ¶ added in v0.14.0
func (mock *IndexerMock) CreateIndexCalls() []struct { Ctx context.Context ServiceAuthToken string SearchAPISearchURL string HttpClient dpHTTP.Clienter }
CreateIndexCalls gets all the calls that were made to CreateIndex. Check the length with:
len(mockedIndexer.CreateIndexCalls())
func (*IndexerMock) GetIndexNameFromResponse ¶ added in v0.14.0
func (mock *IndexerMock) GetIndexNameFromResponse(ctx context.Context, body io.ReadCloser) (string, error)
GetIndexNameFromResponse calls GetIndexNameFromResponseFunc.
func (*IndexerMock) GetIndexNameFromResponseCalls ¶ added in v0.14.0
func (mock *IndexerMock) GetIndexNameFromResponseCalls() []struct { Ctx context.Context Body io.ReadCloser }
GetIndexNameFromResponseCalls gets all the calls that were made to GetIndexNameFromResponse. Check the length with:
len(mockedIndexer.GetIndexNameFromResponseCalls())
func (*IndexerMock) SendReindexRequestedEvent ¶ added in v0.15.0
func (mock *IndexerMock) SendReindexRequestedEvent(cfg *config.Config, jobID string, indexName string) error
SendReindexRequestedEvent calls SendReindexRequestedEventFunc.
func (*IndexerMock) SendReindexRequestedEventCalls ¶ added in v0.15.0
func (mock *IndexerMock) SendReindexRequestedEventCalls() []struct { Cfg *config.Config JobID string IndexName string }
SendReindexRequestedEventCalls gets all the calls that were made to SendReindexRequestedEvent. Check the length with:
len(mockedIndexer.SendReindexRequestedEventCalls())
type ReindexRequestedProducerMock ¶ added in v0.15.0
type ReindexRequestedProducerMock struct { // ProduceReindexRequestedFunc mocks the ProduceReindexRequested method. ProduceReindexRequestedFunc func(ctx context.Context, event models.ReindexRequested) error // contains filtered or unexported fields }
ReindexRequestedProducerMock is a mock implementation of api.ReindexRequestedProducer.
func TestSomethingThatUsesReindexRequestedProducer(t *testing.T) { // make and configure a mocked api.ReindexRequestedProducer mockedReindexRequestedProducer := &ReindexRequestedProducerMock{ ProduceReindexRequestedFunc: func(ctx context.Context, event models.ReindexRequested) error { panic("mock out the ProduceReindexRequested method") }, } // use mockedReindexRequestedProducer in code that requires api.ReindexRequestedProducer // and then make assertions. }
func (*ReindexRequestedProducerMock) ProduceReindexRequested ¶ added in v0.15.0
func (mock *ReindexRequestedProducerMock) ProduceReindexRequested(ctx context.Context, event models.ReindexRequested) error
ProduceReindexRequested calls ProduceReindexRequestedFunc.
func (*ReindexRequestedProducerMock) ProduceReindexRequestedCalls ¶ added in v0.15.0
func (mock *ReindexRequestedProducerMock) ProduceReindexRequestedCalls() []struct { Ctx context.Context Event models.ReindexRequested }
ProduceReindexRequestedCalls gets all the calls that were made to ProduceReindexRequested. Check the length with:
len(mockedReindexRequestedProducer.ProduceReindexRequestedCalls())