Documentation ¶
Index ¶
Constants ¶
const (
WaitEventTimeout = 5 * time.Second // maximum time that the component test consumer will wait for an elasticsearch call
)
Variables ¶
var ( BuildTime = "1625046891" GitCommit = "7434fe334d9f51b7239f978094ea29d10ac33b16" Version = "" )
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct { componenttest.ErrorFeature ElasticsearchAPI *httpfake.HTTPFake // Elasticsearch API mock at HTTP level KafkaConsumer *kafkatest.Consumer // Mock for service kafka consumer // contains filtered or unexported fields }
func NewComponent ¶
func (*Component) Close ¶
func (c *Component) Close()
Close kills the application under test and waits for it to complete the graceful shutdown, or timeout
func (*Component) GetKafkaConsumer ¶ added in v0.13.0
func (c *Component) GetKafkaConsumer(ctx context.Context, cfg *config.Kafka) (kafka.IConsumerGroup, error)
GetKafkaConsumer creates a new kafkatest consumer and stores it to the caller Component struct It returns the mock, so it can be used by the service under test. If there is any error creating the mock, it is also returned to the service.
func (*Component) RegisterSteps ¶
func (c *Component) RegisterSteps(ctx *godog.ScenarioContext)
type ElasticsearchAssertor ¶ added in v0.13.0
type ElasticsearchAssertor struct {
// contains filtered or unexported fields
}
ElasticsearchAssertor implements httpfake.Assertor so it can be registered to component test HTTP mocks It contains an array of expected queries and a channel where the ElasticsearchCalls will be sent
func NewAssertor ¶ added in v0.13.0
func NewAssertor(expected []byte) (*ElasticsearchAssertor, error)
NewAssertor creates a new Elasticsearch Assertor If a non-nil expected byte array is provided, it will be converted into a slice of pretty json strings
func (*ElasticsearchAssertor) Assert ¶ added in v0.13.0
func (esa *ElasticsearchAssertor) Assert(r *http.Request) error
Assert converts the request body to a slice of pretty json strings and sends them to the 'called' channel, so the caller can do the validation
func (*ElasticsearchAssertor) Error ¶ added in v0.13.0
func (esa *ElasticsearchAssertor) Error(t testing.TB, err error)
func (*ElasticsearchAssertor) Expected ¶ added in v0.13.0
func (esa *ElasticsearchAssertor) Expected() []string
Expected returns a slice of expected queries
func (*ElasticsearchAssertor) Log ¶ added in v0.13.0
func (esa *ElasticsearchAssertor) Log(t testing.TB)
type ElasticsearchCall ¶ added in v0.13.0
ElasticsearchCall represents a call to Elasticsearch, containing the http request pointer and the array of queries obtained from the request body