steps

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 39 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

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

type ErrorFeature struct {
	testing.TB
	// contains filtered or unexported fields
}

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

func (*FakeAPI) Close added in v0.19.0

func (f *FakeAPI) Close()

func (*FakeAPI) Reset added in v0.19.0

func (f *FakeAPI) Reset()

func (*FakeAPI) Restart added in v0.19.0

func (f *FakeAPI) Restart()

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 /search-reindex-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

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 /search-reindex-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 /search-reindex-jobs/{id}/tasks endpoint

func (*SearchReindexAPIFeature) PutNumberOfDocs added in v0.24.0

func (f *SearchReindexAPIFeature) PutNumberOfDocs(version, id, taskName, countStr string) error

PutNumberOfTasks can be called by a feature step in order to call the PUT /search-reindex-jobs/{id}/number-of-tasks/{count} 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 /search-reindex-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.

Jump to

Keyboard shortcuts

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