componenttest

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 13 Imported by: 29

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNopExporterFactory added in v0.23.0

func NewNopExporterFactory() component.ExporterFactory

NewNopExporterFactory returns a component.ExporterFactory that constructs nop exporters.

func NewNopExtensionFactory added in v0.23.0

func NewNopExtensionFactory() component.ExtensionFactory

NewNopExtensionFactory returns a component.ExtensionFactory that constructs nop exporters.

func NewNopHost

func NewNopHost() component.Host

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

func NewNopProcessorFactory added in v0.23.0

func NewNopProcessorFactory() component.ProcessorFactory

NewNopProcessorFactory returns a component.ProcessorFactory that constructs nop exporters.

func NewNopReceiverFactory added in v0.23.0

func NewNopReceiverFactory() component.ReceiverFactory

NewNopReceiverFactory returns a component.ReceiverFactory that constructs nop exporters.

func NopFactories added in v0.23.0

func NopFactories() (component.Factories, error)

NopFactories returns a component.Factories with all nop factories.

func VerifyProcessorShutdown added in v0.22.0

func VerifyProcessorShutdown(t *testing.T, factory component.ProcessorFactory, cfg configmodels.Processor)

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 (*ErrorWaitingHost) GetExtensions

func (ews *ErrorWaitingHost) GetExtensions() map[configmodels.NamedEntity]component.Extension

func (*ErrorWaitingHost) GetFactory

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.

Jump to

Keyboard shortcuts

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