Back to godoc.org
go.opentelemetry.io/collector/component/componenttest

package componenttest

v0.4.0
Latest Go to latest
Published: Jun 16, 2020 | License: Apache-2.0 | Module: go.opentelemetry.io/collector

Overview

Package componenttest define types and functions used to help test packages implementing the component package interfaces.

Index

func NewNopHost

func NewNopHost() component.Host

NewNopHost returns a new instance of NopHost with proper defaults for most tests.

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

func (nh *NopHost) GetFactory(_ component.Kind, _ configmodels.Type) component.Factory

GetFactory of the specified kind. Returns the factory for a component type.

func (*NopHost) ReportFatalError

func (nh *NopHost) ReportFatalError(_ error)

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier