Documentation ¶
Overview ¶
Package steps is used to define the steps that are used in the component test, which is written in godog (Go's version of cucumber).
Index ¶
- func DoGetKafkaProducerChecker(ctx context.Context, state *healthcheck.CheckState) error
- type ErrorFeature
- type FakeAPI
- type SearchReindexAPIFeature
- func (f *SearchReindexAPIFeature) CallGetJobByID(version, id string) error
- func (f *SearchReindexAPIFeature) Close() error
- func (f *SearchReindexAPIFeature) DoGetAuthorisationHandlers(ctx context.Context, cfg *config.Config) api.AuthHandler
- func (f *SearchReindexAPIFeature) DoGetHTTPServer(bindAddr string, router http.Handler) service.HTTPServer
- func (f *SearchReindexAPIFeature) DoGetHealthcheckOk(cfg *config.Config, curTime, commit, version string) (service.HealthChecker, error)
- func (f *SearchReindexAPIFeature) DoGetKafkaProducer(ctx context.Context, cfg *config.Config) (service.KafkaProducer, error)
- func (f *SearchReindexAPIFeature) DoGetMongoDB(ctx context.Context, cfg *config.Config) (service.MongoDataStorer, error)
- func (f *SearchReindexAPIFeature) GetTaskForJob(version, jobID, taskName string) error
- func (f *SearchReindexAPIFeature) InitAPIFeature() *componentTest.APIFeature
- func (f *SearchReindexAPIFeature) InitialiseService() (http.Handler, error)
- func (f *SearchReindexAPIFeature) PostTaskForJob(version, jobID string, requestBody *godog.DocString) error
- func (f *SearchReindexAPIFeature) PutNumberOfTasks(version, id, countStr string) error
- func (f *SearchReindexAPIFeature) RegisterSteps(ctx *godog.ScenarioContext)
- func (f *SearchReindexAPIFeature) Reset(mongoFail bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoGetKafkaProducerChecker ¶ added in v0.18.0
func DoGetKafkaProducerChecker(ctx context.Context, state *healthcheck.CheckState) error
DoGetKafkaProducerChecker is used to mock the kafka producer CheckerFunc
Types ¶
type ErrorFeature ¶ added in v0.14.0
func (*ErrorFeature) Errorf ¶ added in v0.14.0
func (t *ErrorFeature) Errorf(format string, args ...interface{})
func (*ErrorFeature) Helper ¶ added in v0.14.0
func (t *ErrorFeature) Helper()
func (*ErrorFeature) Log ¶ added in v0.14.0
func (t *ErrorFeature) Log(args ...interface{})
func (*ErrorFeature) Logf ¶ added in v0.14.0
func (t *ErrorFeature) Logf(format string, args ...interface{})
func (*ErrorFeature) Name ¶ added in v0.14.0
func (t *ErrorFeature) Name() string
func (*ErrorFeature) StepError ¶ added in v0.14.0
func (t *ErrorFeature) StepError() error
type FakeAPI ¶ added in v0.19.0
type FakeAPI struct {
// contains filtered or unexported fields
}
func NewFakeSearchAPI ¶ added in v0.19.0
func NewFakeSearchAPI() *FakeAPI
type SearchReindexAPIFeature ¶ added in v0.18.0
type SearchReindexAPIFeature struct { APIFeature *componentTest.APIFeature AuthFeature *componentTest.AuthorizationFeature Config *config.Config ErrorFeature componentTest.ErrorFeature HTTPServer *http.Server KafkaProducer service.KafkaProducer KafkaMessageProducer kafka.IProducer MongoClient *mongo.JobStore MongoFeature *componentTest.MongoFeature ServiceRunning bool // contains filtered or unexported fields }
SearchReindexAPIFeature is a type that contains all the requirements for running a godog (cucumber) feature that tests the SearchReindexAPIFeature endpoints.
func NewSearchReindexAPIFeature ¶ added in v0.18.0
func NewSearchReindexAPIFeature(mongoFeature *componentTest.MongoFeature, authFeature *componentTest.AuthorizationFeature, fakeSearchAPI *FakeAPI) (*SearchReindexAPIFeature, error)
NewSearchReindexAPIFeature returns a pointer to a new SearchReindexAPIFeature, which can then be used for testing the SearchReindexAPIFeature endpoints.
func (*SearchReindexAPIFeature) CallGetJobByID ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) CallGetJobByID(version, id string) error
CallGetJobByID can be called by a feature step in order to call the GET /jobs/{id} endpoint.
func (*SearchReindexAPIFeature) Close ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) Close() error
Close stops the *service.Service, which is pointed to from within the specific SearchReindexAPIFeature, from running.
func (*SearchReindexAPIFeature) DoGetAuthorisationHandlers ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) DoGetAuthorisationHandlers(ctx context.Context, cfg *config.Config) api.AuthHandler
DoGetAuthorisationHandlers returns the mock AuthHandler that was created in the NewSearchReindexAPIFeature function.
func (*SearchReindexAPIFeature) DoGetHTTPServer ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) DoGetHTTPServer(bindAddr string, router http.Handler) service.HTTPServer
DoGetHTTPServer takes a bind Address (string) and a router (http.Handler), which are used to set up an HTTPServer. The HTTPServer is in a specific SearchReindexAPIFeature and is returned.
func (*SearchReindexAPIFeature) DoGetHealthcheckOk ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) DoGetHealthcheckOk(cfg *config.Config, curTime, commit, version string) (service.HealthChecker, error)
DoGetHealthcheckOk returns a mock HealthChecker service for a specific SearchReindexAPIFeature.
func (*SearchReindexAPIFeature) DoGetKafkaProducer ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) DoGetKafkaProducer(ctx context.Context, cfg *config.Config) (service.KafkaProducer, error)
DoGetKafkaProducer returns a mock kafka producer.
func (*SearchReindexAPIFeature) DoGetMongoDB ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) DoGetMongoDB(ctx context.Context, cfg *config.Config) (service.MongoDataStorer, error)
DoGetMongoDB returns a MongoDB, for the component test, which has a random database name and different URI to the one used by the API under test.
func (*SearchReindexAPIFeature) GetTaskForJob ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) GetTaskForJob(version, jobID, taskName string) error
GetTaskForJob can be called by a feature step in order to call the GET /jobs/{id}/tasks/{task name} endpoint
func (*SearchReindexAPIFeature) InitAPIFeature ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) InitAPIFeature() *componentTest.APIFeature
InitAPIFeature initialises the APIFeature that's contained within a specific SearchReindexAPIFeature.
func (*SearchReindexAPIFeature) InitialiseService ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) InitialiseService() (http.Handler, error)
InitialiseService returns the http.Handler that's contained within a specific SearchReindexAPIFeature.
func (*SearchReindexAPIFeature) PostTaskForJob ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) PostTaskForJob(version, jobID string, requestBody *godog.DocString) error
PostTaskForJob can be called by a feature step in order to call the POST /jobs/{id}/tasks endpoint
func (*SearchReindexAPIFeature) PutNumberOfTasks ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) PutNumberOfTasks(version, id, countStr string) error
PutNumberOfTasks can be called by a feature step in order to call the PUT /jobs/{id}/number_of_tasks/{count} endpoint
func (*SearchReindexAPIFeature) RegisterSteps ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) RegisterSteps(ctx *godog.ScenarioContext)
RegisterSteps defines the steps within a specific SearchReindexAPIFeature cucumber test.
func (*SearchReindexAPIFeature) Reset ¶ added in v0.18.0
func (f *SearchReindexAPIFeature) Reset(mongoFail bool) error
Reset sets the resources within a specific SearchReindexAPIFeature back to their default values.