fixtures

package
v0.0.0-...-7a0dfb2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

This is for test fixtures only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropSource

func DropSource(m *gostatsd.Metric)

func MakeMetric

func MakeMetric(opts ...MetricOpt) *gostatsd.Metric

MakeMetric provides a way to build a metric for tests. Hopefully over time this will be used more, bringing more consistency to tests.

func NewAdvancingClock

func NewAdvancingClock(ctx context.Context) (context.Context, func())

NewAdvancingClock attaches a virtual clock to a context which advances at full speed (not wall speed), and a cancel function to stop it. The clock also stops if the context is canceled.

func NextStep

func NextStep(ctx context.Context, clck *clock.Mock)

NextStep will advance the supplied clock.Mock until it moves, or the context.Context is canceled (which typically means it timed out in wall-time). This is useful when testing things that exist inside goroutines, when it's not possible to tell when the goroutine is ready to consume mock time.

func SortCompare

func SortCompare(ms []*gostatsd.Metric) func(i, j int) bool

SortCompare func for metrics so they can be compared with require.EqualValues Invoke with sort.Slice(x, SortCompare(x))

Types

type MetricOpt

type MetricOpt func(m *gostatsd.Metric)

func AddTag

func AddTag(t ...string) MetricOpt

func DropTag

func DropTag(t string) MetricOpt

func Name

func Name(n string) MetricOpt

Jump to

Keyboard shortcuts

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