testonly

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestCounter

func TestCounter(t *testing.T, factory monitoring.MetricFactory)

TestCounter runs a test on a Counter produced from the provided MetricFactory.

func TestGauge

func TestGauge(t *testing.T, factory monitoring.MetricFactory)

TestGauge runs a test on a Gauge produced from the provided MetricFactory.

func TestHistogram

func TestHistogram(t *testing.T, factory monitoring.MetricFactory)

TestHistogram runs a test on a Histogram produced from the provided MetricFactory.

Types

type CounterSnapshot added in v1.3.0

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

CounterSnapshot records the latest value from a time series in a counter. This value can then be compared with future values. Note that a counter can contain many time series, but a CounterSnapshot will track only one. A CounterSnapshot is useful in tests because counters do not reset between test cases, and so their absolute value is not amenable to testing. Instead, the delta between the value at the start and end of the test should be used. This assumes that multiple tests that all affect the counter are not run in parallel.

func NewCounterSnapshot added in v1.3.0

func NewCounterSnapshot(c monitoring.Counter, labels ...string) CounterSnapshot

NewCounterSnapshot records the latest value of a time series in c identified by the given labels. This value can be compared to future values to determine how it has changed over time.

func (CounterSnapshot) Delta added in v1.3.0

func (s CounterSnapshot) Delta() float64

Delta returns the difference between the latest value of the time series and the value when the CounterSnapshot was created.

Jump to

Keyboard shortcuts

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