MCPcopy Create free account
hub / github.com/bitly/statsdaemon / TestProcessTimers

Function TestProcessTimers

statsdaemon_test.go:518–538  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

516}
517
518func TestProcessTimers(t *testing.T) {
519 // Some data with expected mean of 20
520 timers = make(map[string]Float64Slice)
521 timers["response_time"] = []float64{0, 30, 30}
522
523 now := int64(1418052649)
524
525 var buffer bytes.Buffer
526 num := processTimers(&buffer, now, Percentiles{})
527
528 lines := bytes.Split(buffer.Bytes(), []byte("\n"))
529
530 assert.Equal(t, num, int64(1))
531 assert.Equal(t, string(lines[0]), "response_time.mean 20 1418052649")
532 assert.Equal(t, string(lines[1]), "response_time.upper 30 1418052649")
533 assert.Equal(t, string(lines[2]), "response_time.lower 0 1418052649")
534 assert.Equal(t, string(lines[3]), "response_time.count 3 1418052649")
535
536 num = processTimers(&buffer, now, Percentiles{})
537 assert.Equal(t, num, int64(0))
538}
539
540func TestProcessGauges(t *testing.T) {
541 flag.Set("delete-gauges", "false")

Callers

nothing calls this directly

Calls 1

processTimersFunction · 0.85

Tested by

no test coverage detected