Documentation
¶
Index ¶
- func Fatal(tb testing.TB) testing.TB
- type Sink
- func (s *Sink) AssertCounterCallCount(tb testing.TB, name string, exp int)
- func (s *Sink) AssertCounterEquals(tb testing.TB, name string, exp uint64)
- func (s *Sink) AssertCounterExists(tb testing.TB, name string)
- func (s *Sink) AssertCounterNotExists(tb testing.TB, name string)
- func (s *Sink) AssertGaugeCallCount(tb testing.TB, name string, exp int)
- func (s *Sink) AssertGaugeEquals(tb testing.TB, name string, exp uint64)
- func (s *Sink) AssertGaugeExists(tb testing.TB, name string)
- func (s *Sink) AssertGaugeNotExists(tb testing.TB, name string)
- func (s *Sink) AssertTimerCallCount(tb testing.TB, name string, exp int)
- func (s *Sink) AssertTimerEquals(tb testing.TB, name string, exp float64)
- func (s *Sink) AssertTimerExists(tb testing.TB, name string)
- func (s *Sink) AssertTimerNotExists(tb testing.TB, name string)
- func (s *Sink) Counter(name string) uint64
- func (s *Sink) CounterCallCount(name string) int64
- func (s *Sink) Counters() map[string]uint64
- func (*Sink) Flush()
- func (s *Sink) FlushCounter(name string, val uint64)
- func (s *Sink) FlushGauge(name string, val uint64)
- func (s *Sink) FlushTimer(name string, val float64)
- func (s *Sink) Gauge(name string) uint64
- func (s *Sink) GaugeCallCount(name string) int64
- func (s *Sink) Gauges() map[string]uint64
- func (s *Sink) LoadCounter(name string) (uint64, bool)
- func (s *Sink) LoadGauge(name string) (uint64, bool)
- func (s *Sink) LoadTimer(name string) (float64, bool)
- func (s *Sink) Reset()
- func (s *Sink) Timer(name string) float64
- func (s *Sink) TimerCallCount(name string) int64
- func (s *Sink) Timers() map[string]float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
Fatal is a wrapper around *testing.T and *testing.B that causes Sink Assert* methods to immediately fail a test and stop execution. Otherwise, the Assert methods call tb.Errorf(), which marks the test as failed, but allows execution to continue.
Examples of Fatal() can be found in the sink test code.
var sink Sink var t *testing.T sink.AssertCounterEquals(Must(t), "name", 1)
Types ¶
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
A Sink is a mock sink meant for testing that is safe for concurrent use.
func NewSink ¶
func NewSink() *Sink
NewSink returns a new Sink which implements the stats.Sink interface and is suitable for testing.
func (*Sink) AssertCounterCallCount ¶
AssertCounterCallCount asserts that Counter name was called exp times.
func (*Sink) AssertCounterEquals ¶
AssertCounterEquals asserts that Counter name is present and has value exp.
func (*Sink) AssertCounterExists ¶
AssertCounterExists asserts that Counter name exists.
func (*Sink) AssertCounterNotExists ¶
AssertCounterNotExists asserts that Counter name does not exist.
func (*Sink) AssertGaugeCallCount ¶
AssertGaugeCallCount asserts that Gauge name was called exp times.
func (*Sink) AssertGaugeEquals ¶
AssertGaugeEquals asserts that Gauge name is present and has value exp.
func (*Sink) AssertGaugeExists ¶
AssertGaugeExists asserts that Gauge name exists.
func (*Sink) AssertGaugeNotExists ¶
AssertGaugeNotExists asserts that Gauge name does not exist.
func (*Sink) AssertTimerCallCount ¶
AssertTimerCallCount asserts that Timer name was called exp times.
func (*Sink) AssertTimerEquals ¶
AssertTimerEquals asserts that Timer name is present and has value exp.
func (*Sink) AssertTimerExists ¶
AssertTimerExists asserts that Timer name exists.
func (*Sink) AssertTimerNotExists ¶
AssertTimerNotExists asserts that Timer name does not exist.
func (*Sink) Counter ¶
Counter is shorthand for LoadCounter, zero is returned if the stat is not found.
func (*Sink) CounterCallCount ¶
CounterCallCount returns the number of times stat name has been called/updated.
func (*Sink) Counters ¶ added in v0.4.2
Counters returns all the counters currently stored by the sink.
func (*Sink) FlushCounter ¶
FlushCounter implements the stats.Sink.FlushCounter method and adds val to stat name.
func (*Sink) FlushGauge ¶
FlushGauge implements the stats.Sink.FlushGauge method and adds val to stat name.
func (*Sink) FlushTimer ¶
FlushTimer implements the stats.Sink.FlushTimer method and adds val to stat name.
func (*Sink) GaugeCallCount ¶
GaugeCallCount returns the number of times stat name has been called/updated.
func (*Sink) LoadCounter ¶
LoadCounter returns the value for stat name and if it was found.
func (*Sink) Reset ¶
func (s *Sink) Reset()
Reset resets the Sink's counters, timers and gauges to zero.
func (*Sink) TimerCallCount ¶
TimerCallCount returns the number of times stat name has been called/updated.