aggregatortest

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Magnitude = 1000

Magnitude is the upper-bound of random numbers used in profile tests.

Variables

This section is empty.

Functions

func CheckedMerge

func CheckedMerge(t *testing.T, aggInto, aggFrom aggregator.Aggregator, descriptor *sdkapi.Descriptor)

CheckedMerge verifies aggFrom merges into aggInto with the scope of descriptor.

func CheckedUpdate

func CheckedUpdate(t *testing.T, agg aggregator.Aggregator, n number.Number, descriptor *sdkapi.Descriptor)

CheckedUpdate performs the same range test the SDK does on behalf of the aggregator.

func NewAggregatorTest

func NewAggregatorTest(mkind sdkapi.InstrumentKind, nkind number.Kind) *sdkapi.Descriptor

NewAggregatorTest returns a descriptor for mkind and nkind.

func RunProfiles

func RunProfiles(t *testing.T, f func(*testing.T, Profile))

RunProfiles runs all test profile against the factory function f.

func SynchronizedMoveResetTest

func SynchronizedMoveResetTest(t *testing.T, mkind sdkapi.InstrumentKind, nf func(*sdkapi.Descriptor) aggregator.Aggregator)

SynchronizedMoveResetTest tests SynchronizedMove behavior for an aggregator during resets.

func TestMain

func TestMain(m *testing.M)

TestMain ensures local struct alignment prior to running tests.

Types

type NoopAggregation

type NoopAggregation struct{}

NoopAggregation is an aggregation that performs no operations.

func (NoopAggregation) Kind

Kind returns a Noop aggregation Kind.

type NoopAggregator

type NoopAggregator struct{}

NoopAggregator is an aggregator that performs no operations.

func (NoopAggregator) Aggregation

func (NoopAggregator) Aggregation() aggregation.Aggregation

Aggregation returns a NoopAggregation.

func (NoopAggregator) Merge

Merge performs no operation.

func (NoopAggregator) SynchronizedMove

SynchronizedMove performs no operation.

func (NoopAggregator) Update

Update performs no operation.

type Numbers

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

Numbers are a collection of measured data point values.

func NewNumbers

func NewNumbers(kind number.Kind) Numbers

NewNumbers returns a new Numbers for the passed kind.

func (*Numbers) Append

func (n *Numbers) Append(v number.Number)

Append appends v to the numbers n.

func (*Numbers) Count

func (n *Numbers) Count() uint64

Count returns the number of data points Numbers contains.

func (*Numbers) Len

func (n *Numbers) Len() int

Len returns number of data points Numbers contains.

func (*Numbers) Less

func (n *Numbers) Less(i, j int) bool

Less returns if the number at index i is less than the number at index j.

func (*Numbers) Max

func (n *Numbers) Max() number.Number

Max returns the max number.

func (*Numbers) Min

func (n *Numbers) Min() number.Number

Min returns the min number.

func (*Numbers) Points

func (n *Numbers) Points() []number.Number

Points returns the slice of number for all data points.

func (*Numbers) Sort

func (n *Numbers) Sort()

Sort sorts all the numbers contained in n.

func (*Numbers) Sum

func (n *Numbers) Sum() number.Number

Sum returns the sum of all data points.

func (*Numbers) Swap

func (n *Numbers) Swap(i, j int)

Swap swaps the location of the numbers at index i and j.

type Profile

type Profile struct {
	NumberKind number.Kind
	Random     func(sign int) number.Number
}

Profile is an aggregator test profile.

Jump to

Keyboard shortcuts

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