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 ¶
- type JobsFeature
- func (f *JobsFeature) Close() error
- func (f *JobsFeature) DoGetHTTPServer(bindAddr string, router http.Handler) service.HTTPServer
- func (f *JobsFeature) DoGetHealthcheckOk(cfg *config.Config, time string, commit string, version string) (service.HealthChecker, error)
- func (f *JobsFeature) DoGetMongoDB(ctx context.Context, cfg *config.Config) (service.MongoJobStorer, error)
- func (f *JobsFeature) GetJobByID(id string) error
- func (f *JobsFeature) InitAPIFeature() *componentTest.APIFeature
- func (f *JobsFeature) InitialiseService() (http.Handler, error)
- func (f *JobsFeature) PutNumberOfTasks(countStr string) error
- func (f *JobsFeature) RegisterSteps(ctx *godog.ScenarioContext)
- func (f *JobsFeature) Reset(mongoFail bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobsFeature ¶
type JobsFeature struct { ErrorFeature componentTest.ErrorFeature Config *config.Config HTTPServer *http.Server ServiceRunning bool ApiFeature *componentTest.APIFeature MongoClient *mongo.JobStore MongoFeature *componentTest.MongoFeature // contains filtered or unexported fields }
JobsFeature is a type that contains all the requirements for running a godog (cucumber) feature that tests the /jobs endpoint.
func NewJobsFeature ¶
func NewJobsFeature(mongoFeature *componentTest.MongoFeature) (*JobsFeature, error)
NewJobsFeature returns a pointer to a new JobsFeature, which can then be used for testing the /jobs endpoint.
func (*JobsFeature) Close ¶
func (f *JobsFeature) Close() error
Close stops the *service.Service, which is pointed to from within the specific JobsFeature, from running.
func (*JobsFeature) DoGetHTTPServer ¶
func (f *JobsFeature) 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 JobsFeature and is returned.
func (*JobsFeature) DoGetHealthcheckOk ¶
func (f *JobsFeature) DoGetHealthcheckOk(cfg *config.Config, time string, commit string, version string) (service.HealthChecker, error)
DoGetHealthcheckOk returns a mock HealthChecker service for a specific JobsFeature.
func (*JobsFeature) DoGetMongoDB ¶ added in v0.5.0
func (f *JobsFeature) DoGetMongoDB(ctx context.Context, cfg *config.Config) (service.MongoJobStorer, 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 (*JobsFeature) GetJobByID ¶ added in v0.7.0
func (f *JobsFeature) GetJobByID(id string) error
GetJobByID is a utility function that is used for calling the GET /jobs/{id} endpoint. It checks that the id string is a valid UUID before calling the endpoint.
func (*JobsFeature) InitAPIFeature ¶
func (f *JobsFeature) InitAPIFeature() *componentTest.APIFeature
InitAPIFeature initialises the ApiFeature that's contained within a specific JobsFeature.
func (*JobsFeature) InitialiseService ¶
func (f *JobsFeature) InitialiseService() (http.Handler, error)
InitialiseService returns the http.Handler that's contained within a specific JobsFeature.
func (*JobsFeature) PutNumberOfTasks ¶ added in v0.7.0
func (f *JobsFeature) PutNumberOfTasks(countStr string) error
PutNumberOfTasks is a utility function that is used for calling the PUT /jobs/{id}/number_of_tasks/{count} It checks that the id string is a valid UUID before calling the endpoint.
func (*JobsFeature) RegisterSteps ¶
func (f *JobsFeature) RegisterSteps(ctx *godog.ScenarioContext)
RegisterSteps defines the steps within a specific JobsFeature cucumber test.
func (*JobsFeature) Reset ¶
func (f *JobsFeature) Reset(mongoFail bool) error
Reset sets the resources within a specific JobsFeature back to their default values.