neotest

package
v3.11.0-beta2+incompat... Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FixedTime func() time.Time

FixedTime is always at 2016-01-05T15:04:05-06:00

Functions

func AdvancedNow

func AdvancedNow(oldNow func() time.Time, d time.Duration) func() time.Time

AdvancedNow returns a now time.Now-compatible function that returns the time returned from oldNow advanced by the given Duration d.

func CloneTestData

func CloneTestData(t *testing.T) (string, func())

CloneTestData clones the test data into a temporary directory and changes the working directory to the temporary directory. The function returned should be run as a deferred to restore the working directory and remove the files.

func Dump

func Dump(t *testing.T, i interface{})

Dump i to stdout using JSON

func LoadJSON

func LoadJSON(t *testing.T, path string, dst interface{})

LoadJSON unmarshals JSON for a test

func Must

func Must(t *testing.T, err error)

Must calls fatal in the given test if err is non-nil

func PinnedNow

func PinnedNow(t time.Time) func() time.Time

PinnedNow returns a function that is compatible with time.Now that always returns the given t Time.

Types

type TestOutput

type TestOutput struct {
	// contains filtered or unexported fields
}

TestOutput can be used in place of the normal monitor outut to provide a simpler way of testing monitor output.

func NewTestOutput

func NewTestOutput() *TestOutput

NewTestOutput creates a new initialized TestOutput instance

func (*TestOutput) AddExtraDimension

func (to *TestOutput) AddExtraDimension(key, value string)

AddExtraDimension is a noop here

func (*TestOutput) FlushDatapoints

func (to *TestOutput) FlushDatapoints() []*datapoint.Datapoint

FlushDatapoints returns all of the datapoints injected into the channel so far.

func (*TestOutput) FlushEvents

func (to *TestOutput) FlushEvents() []*event.Event

FlushEvents returns all of the datapoints injected into the channel so far.

func (*TestOutput) RemoveExtraDimension

func (to *TestOutput) RemoveExtraDimension(key string)

RemoveExtraDimension is a noop here

func (*TestOutput) SendDatapoint

func (to *TestOutput) SendDatapoint(dp *datapoint.Datapoint)

SendDatapoint accepts a datapoint and sticks it in a buffered queue

func (*TestOutput) SendDimensionProps

func (to *TestOutput) SendDimensionProps(dimProps *types.DimProperties)

SendDimensionProps accepts a dim prop update and sticks it in a buffered queue

func (*TestOutput) SendEvent

func (to *TestOutput) SendEvent(event *event.Event)

SendEvent accepts an event and sticks it in a buffered queue

func (*TestOutput) SendSpan

func (to *TestOutput) SendSpan(span *trace.Span)

SendSpan accepts a trace span and sticks it in a buffered queue

func (*TestOutput) WaitForDPs

func (to *TestOutput) WaitForDPs(count, waitSeconds int) []*datapoint.Datapoint

WaitForDPs will keep pulling datapoints off of the internal queue until it either gets the expected count or waitSeconds seconds have elapsed. It then returns those datapoints. It will never return more than 'count' datapoints.

func (*TestOutput) WaitForDimensionProps

func (to *TestOutput) WaitForDimensionProps(count, waitSeconds int) []*types.DimProperties

WaitForDimensionProps will keep pulling dimension property updates off of the internal queue until it either gets the expected count or waitSeconds seconds have elapsed. It then returns those dimension property updates. It will never return more than 'count' objects.

Directories

Path Synopsis
k8s

Jump to

Keyboard shortcuts

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