Documentation
¶
Overview ¶
Package receivertest define types and functions used to help test packages implementing the receiver package interfaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component interface { // Start tells the component to start. Host parameter can be used for communicating // with the host after Start() has already returned. If error is returned by // Start() then the collector startup will be aborted. // If this is an exporter component it may prepare for exporting // by connecting to the endpoint. Start(host Host) error // Shutdown is invoked during service shutdown. Shutdown() error }
Component is either a receiver, exporter, processor or extension.
type Host ¶
type Host interface { // ReportFatalError is used to report to the host that the extension // encountered a fatal error (i.e.: an error that the instance can't recover // from) after its start function had already returned. ReportFatalError(err error) // Context returns a context provided by the host to be used on the component // operations. Context() context.Context }
Host represents the entity that is hosting a Component. It is used to allow communication between the Component and its host (normally the service.Application is the host).
func NewMockHost ¶
func NewMockHost() Host
NewMockHost returns a new instance of MockHost with proper defaults for most tests.
type MockHost ¶
type MockHost struct { }
MockHost mocks a receiver.ReceiverHost for test purposes.
func (*MockHost) Context ¶
Context returns a context provided by the host to be used on the receiver operations.
func (*MockHost) ReportFatalError ¶
ReportFatalError is used to report to the host that the receiver encountered a fatal error (i.e.: an error that the instance can't recover from) after its start function has already returned.