componenttest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 3 Imported by: 28

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 NewNopHost

func NewNopHost() component.Host

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

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.

type NopHost

type NopHost struct {
}

NopHost mocks a receiver.ReceiverHost for test purposes.

func (*NopHost) GetExporters

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.

Jump to

Keyboard shortcuts

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