steps

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentTestGroup    = "test-consumer-group"
	DrainTopicTimeout     = 10 * time.Second // maximum time to wait for a topic to be drained
	DrainTopicMaxMessages = 1000             // maximum number of messages that will be drained from a topic
	MinioCheckRetries     = 3                // maximum number of retires to validate that a file is present in minio
	WaitEventTimeout      = 10 * time.Second // maximum time that the component test consumer will wait for a
)

Variables

View Source
var (
	BuildTime string = "1625046891"
	GitCommit string = "7434fe334d9f51b7239f978094ea29d10ac33b16"
	Version   string = ""
)

Functions

func GenerateKafkaConsumer added in v1.2.0

func GenerateKafkaConsumer(ctx context.Context) (*kafka.ConsumerGroup, error)

GenerateKafkaConsumer produces a consumer for specific steps. Currently only for PUT filters/{id}/submit

func GetFailingMongo

func GetFailingMongo(ctx context.Context, cfg *config.Config, g service.Generator) (service.Datastore, error)

keep adding new handler functions for which the mongo needs to fail

func GetWorkingMongo

func GetWorkingMongo(ctx context.Context, cfg *config.Config, g service.Generator) (service.Datastore, error)

Types

type Component

type Component struct {
	componenttest.ErrorFeature
	ApiFeature *componenttest.APIFeature

	DatasetAPI       *httpfake.HTTPFake
	CantabularClient *mock.CantabularClient

	HTTPServer *http.Server
	// contains filtered or unexported fields
}

func NewComponent

func NewComponent(t *testing.T, zebedeeURL, mongoAddr string) (*Component, error)

func (*Component) Close

func (c *Component) Close()

Close kills the application under test, and then it shuts down the testing producer.

func (*Component) Init

func (c *Component) Init() (http.Handler, error)

Init initialises the server, the mocks and waits for the dependencies to be ready

func (*Component) MongoDatastoreFailsForUpdateFilterOutput

func (c *Component) MongoDatastoreFailsForUpdateFilterOutput() error

func (*Component) MongoDatastoreIsFailing added in v1.2.0

func (c *Component) MongoDatastoreIsFailing() error

func (*Component) RegisterSteps

func (c *Component) RegisterSteps(ctx *godog.ScenarioContext)

func (*Component) Reset

func (c *Component) Reset() error

Reset re-initialises the service under test and the api mocks. Note that the service under test should not be started yet to prevent race conditions if it tries to call un-initialised dependencies (steps)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳