pomerium/internal/telemetry/metrics/kv_test.go
bobby f837c92741
dev: update linter (#1728)
- gofumpt everything
- fix TLS MinVersion to be at least 1.2
- add octal syntax
- remove newlines
- fix potential decompression bomb in ecjson
- remove implicit memory aliasing in for loops.

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-12-30 09:02:57 -08:00

33 lines
731 B
Go

package metrics
import (
"testing"
redis "github.com/go-redis/redis/v8"
"go.opencensus.io/metric/metricdata"
)
func Test_AddRedisMetrics(t *testing.T) {
t.Parallel()
tests := []struct {
name string
stat redis.PoolStats
want int64
}{
{"redis_conns", redis.PoolStats{TotalConns: 7}, 7},
{"redis_idle_conns", redis.PoolStats{IdleConns: 3}, 3},
{"redis_miss_count_total", redis.PoolStats{Misses: 2}, 2},
}
labelValues := []metricdata.LabelValue{
metricdata.NewLabelValue("redis"),
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
AddRedisMetrics(func() *redis.PoolStats { return &tt.stat })
testMetricRetrieval(registry.registry.Read(), t, labelValues, tt.want, tt.name)
})
}
}