testevent

package
v0.0.0-...-aac4589 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Target    *target.Target
	EventName event.Name
	Payload   *json.RawMessage
}

Data models the data of a test event. It is populated by the TestStep

func (*Data) String

func (d *Data) String() string

type Emitter

type Emitter interface {
	Emit(ctx xcontext.Context, event Data) error
}

Emitter defines the interface that emitter objects must implement

type EmitterFetcher

type EmitterFetcher interface {
	Emitter
	Fetcher
}

EmitterFetcher defines the interface that objects supporting emitting and fetching events must implement

type Event

type Event struct {
	EmitTime time.Time
	Header   *Header
	Data     *Data
}

Event models an event object that can be emitted by a TestStep

func New

func New(header *Header, data *Data) Event

New creates a new Event with zero value header and data

type Fetcher

type Fetcher interface {
	Fetch(ctx xcontext.Context, fields ...QueryField) ([]Event, error)
}

Fetcher defines the interface that fetcher objects must implement

type Header struct {
	JobID         types.JobID
	RunID         types.RunID
	TestName      string
	TestStepLabel string
}

Header models the header of a test event, which consists in metadata that defines the emitter of the events. The Header is under ConTest control and cannot be manipulated by the TestStep

func (*Header) String

func (h *Header) String() string

type Query

type Query struct {
	event.Query
	RunID         types.RunID
	TestName      string
	TestStepLabel string
}

Query wraps information that are used to build queries for test events, on top of the common EventQuery fields

func BuildQuery

func BuildQuery(queryFields ...QueryField) (*Query, error)

BuildQuery compiles a Query from scratch using values of queryFields. It does basically just creates an empty query an applies queryFields to it.

type QueryField

type QueryField interface {
	// contains filtered or unexported methods
}

QueryField defines a function type used to set a field's value on Query objects

func QueryEmittedEndTime

func QueryEmittedEndTime(emittedEndTime time.Time) QueryField

QueryEmittedEndTime sets the EmittedEndTime field of the Query object

func QueryEmittedStartTime

func QueryEmittedStartTime(emittedStartTime time.Time) QueryField

QueryEmittedStartTime sets the EmittedStartTime field of the Query object

func QueryEventName

func QueryEventName(eventName event.Name) QueryField

QueryEventName sets a single EventName field in the Query objec

func QueryEventNames

func QueryEventNames(eventNames []event.Name) QueryField

QueryEventNames the EventNames field of the Query object

func QueryJobID

func QueryJobID(jobID types.JobID) QueryField

QueryJobID sets the JobID field of the Query object

func QueryRunID

func QueryRunID(runID types.RunID) QueryField

QueryRunID sets the RunID field of the Query object

func QueryTestName

func QueryTestName(testName string) QueryField

QueryTestName sets the TestName field of the Query object

func QueryTestStepLabel

func QueryTestStepLabel(testStepLabel string) QueryField

QueryTestStepLabel sets the TestStepLabel field of the Query object

type QueryFields

type QueryFields []QueryField

QueryFields is a set of field values for a Query object

func (QueryFields) BuildQuery

func (queryFields QueryFields) BuildQuery() (*Query, error)

BuildQuery compiles a Query from scratch using values of queryFields. It does basically just creates an empty query an applies queryFields to it.

Jump to

Keyboard shortcuts

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