Documentation ¶
Overview ¶
Package componenttest provides utilities for testing Flow components.
Index ¶
- func TestContext(t testing.TB) context.Context
- type Controller
- func (c *Controller) Exports() component.Exports
- func (c *Controller) Run(ctx context.Context, args component.Arguments) error
- func (c *Controller) Update(args component.Arguments) error
- func (c *Controller) WaitExports(timeout time.Duration) error
- func (c *Controller) WaitRunning(timeout time.Duration) error
- type TestFailArguments
- type TestFailModule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
A Controller is a testing controller which controls a single component.
func NewControllerFromID ¶
func NewControllerFromID(l log.Logger, componentName string) (*Controller, error)
NewControllerFromID returns a new testing Controller for the component with the provided name.
func NewControllerFromReg ¶ added in v0.29.0
func NewControllerFromReg(l log.Logger, reg component.Registration) *Controller
NewControllerFromReg registers a new testing Controller for a component with the given registration. This can be used for testing fake components which aren't really registered.
func (*Controller) Exports ¶
func (c *Controller) Exports() component.Exports
Exports gets the most recent exports for a component.
func (*Controller) Run ¶
Run starts the controller, building and running the component. Run blocks until ctx is canceled, the component exits, or if there was an error.
Run may only be called once per Controller.
func (*Controller) Update ¶
func (c *Controller) Update(args component.Arguments) error
Update updates the running component. Should only be called after Run.
func (*Controller) WaitExports ¶
func (c *Controller) WaitExports(timeout time.Duration) error
WaitExports blocks until new Exports are available up to the provided timeout.
func (*Controller) WaitRunning ¶
func (c *Controller) WaitRunning(timeout time.Duration) error
WaitRunning blocks until the Controller is running up to the provided timeout.
type TestFailArguments ¶ added in v0.38.0
type TestFailModule ¶ added in v0.38.0
type TestFailModule struct {
// contains filtered or unexported fields
}
func (*TestFailModule) Run ¶ added in v0.38.0
func (t *TestFailModule) Run(ctx context.Context) error
func (*TestFailModule) Update ¶ added in v0.38.0
func (t *TestFailModule) Update(_ component.Arguments) error
func (*TestFailModule) UpdateContent ¶ added in v0.38.0
func (t *TestFailModule) UpdateContent(content string) error