steps

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 25 Imported by: 0

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

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
	AuthFeature  *componentTest.AuthorizationFeature
	// 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, authFeature *componentTest.AuthorizationFeature) (*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) DoGetAuthorisationHandlers added in v0.9.0

func (f *JobsFeature) DoGetAuthorisationHandlers(ctx context.Context, cfg *config.Config) api.AuthHandler

DoGetAuthorisationHandlers returns the mock AuthHandler that was created in the NewJobsFeature function.

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.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 (*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) GetTaskForJob added in v0.10.0

func (f *JobsFeature) GetTaskForJob(jobID string, taskName string) error

GetTaskForJob is a utility function that is used for calling GET /jobs/{id}/tasks/{task name}

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) PostTaskForJob added in v0.9.0

func (f *JobsFeature) PostTaskForJob(jobID string, requestBody *godog.DocString) error

PostTaskForJob is a utility function that is used for calling POST /jobs/{id}/tasks The endpoint requires authorisation and a request body.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL