Documentation ¶
Overview ¶
Package componenttest define types and functions used to help test packages implementing the component package interfaces.
Index ¶
- func NewNopHost() component.Host
- type ErrorWaitingHost
- func (ews *ErrorWaitingHost) GetExporters() map[configmodels.DataType]map[configmodels.Exporter]component.Exporter
- func (ews *ErrorWaitingHost) GetExtensions() map[configmodels.Extension]component.ServiceExtension
- func (ews *ErrorWaitingHost) GetFactory(_ component.Kind, _ configmodels.Type) component.Factory
- func (ews *ErrorWaitingHost) ReportFatalError(err error)
- func (ews *ErrorWaitingHost) WaitForFatalError(timeout time.Duration) (receivedError bool, err error)
- type NopHost
- func (nh *NopHost) GetExporters() map[configmodels.DataType]map[configmodels.Exporter]component.Exporter
- func (nh *NopHost) GetExtensions() map[configmodels.Extension]component.ServiceExtension
- func (nh *NopHost) GetFactory(_ component.Kind, _ configmodels.Type) component.Factory
- func (nh *NopHost) ReportFatalError(_ error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNopHost ¶
NewNopHost returns a new instance of NopHost with proper defaults for most tests.
Types ¶
type ErrorWaitingHost ¶
type ErrorWaitingHost struct {
// contains filtered or unexported fields
}
ErrorWaitingHost mocks an component.Host for test purposes.
func NewErrorWaitingHost ¶
func NewErrorWaitingHost() *ErrorWaitingHost
NewErrorWaitingHost returns a new instance of ErrorWaitingHost with proper defaults for most tests.
func (*ErrorWaitingHost) GetExporters ¶
func (ews *ErrorWaitingHost) GetExporters() map[configmodels.DataType]map[configmodels.Exporter]component.Exporter
func (*ErrorWaitingHost) GetExtensions ¶
func (ews *ErrorWaitingHost) GetExtensions() map[configmodels.Extension]component.ServiceExtension
func (*ErrorWaitingHost) GetFactory ¶
func (ews *ErrorWaitingHost) GetFactory(_ component.Kind, _ configmodels.Type) component.Factory
GetFactory of the specified kind. Returns the factory for a component type.
func (*ErrorWaitingHost) ReportFatalError ¶
func (ews *ErrorWaitingHost) ReportFatalError(err error)
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 has already returned.
func (*ErrorWaitingHost) WaitForFatalError ¶
func (ews *ErrorWaitingHost) WaitForFatalError(timeout time.Duration) (receivedError bool, err error)
WaitForFatalError waits the given amount of time until an error is reported via ReportFatalError. It returns the error, if any, and a bool to indicated if an error was received before the time out.
type NopHost ¶
type NopHost struct { }
NopHost mocks a receiver.ReceiverHost for test purposes.
func (*NopHost) GetExporters ¶
func (nh *NopHost) GetExporters() map[configmodels.DataType]map[configmodels.Exporter]component.Exporter
func (*NopHost) GetExtensions ¶
func (nh *NopHost) GetExtensions() map[configmodels.Extension]component.ServiceExtension
func (*NopHost) GetFactory ¶
GetFactory of the specified kind. Returns the factory for a component type.
func (*NopHost) 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.