mockoutput

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockOutput

type MockOutput struct {
	SampleContainers []metrics.SampleContainer
	Samples          []metrics.Sample

	DescFn  func() string
	StartFn func() error
	StopFn  func() error
}

MockOutput can be used in tests to mock an actual output.

func New

func New() *MockOutput

New exists so that the usage from tests avoids repetition, i.e. is mockoutput.New() instead of &mockoutput.MockOutput{}

func (*MockOutput) AddMetricSamples

func (mo *MockOutput) AddMetricSamples(scs []metrics.SampleContainer)

AddMetricSamples just saves the results in memory.

func (*MockOutput) Description

func (mo *MockOutput) Description() string

Description calls the supplied DescFn callback, if available.

func (*MockOutput) Start

func (mo *MockOutput) Start() error

Start calls the supplied StartFn callback, if available.

func (*MockOutput) Stop

func (mo *MockOutput) Stop() error

Stop calls the supplied StopFn callback, if available.

Jump to

Keyboard shortcuts

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