MCPcopy
hub / github.com/grafana/dskit / TestMinGauges

Function TestMinGauges

metrics/tenant_registries_test.go:50–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestMinGauges(t *testing.T) {
51 type testcase struct {
52 exp float64
53 mf MetricFamilyMap
54 }
55
56 for _, tc := range []testcase{
57 {exp: math.NaN(), mf: MetricFamilyMap{}},
58 {exp: math.NaN(), mf: MetricFamilyMap{"metric": nil}},
59 {exp: math.NaN(), mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: nil}}},
60 {exp: math.NaN(), mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: []*dto.Metric{{Gauge: &dto.Gauge{}}}}}},
61 {exp: 12345.6789, mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: []*dto.Metric{{Gauge: &dto.Gauge{Value: proto.Float64(12345.6789)}}}}}},
62 {exp: 1234.56789, mf: MetricFamilyMap{"metric": &dto.MetricFamily{Metric: []*dto.Metric{
63 {Gauge: &dto.Gauge{Value: proto.Float64(1234.56789)}},
64 {Gauge: &dto.Gauge{Value: proto.Float64(7890.12345)}},
65 }}}},
66 } {
67 checkFloats(t, tc.mf.MinGauges("metric"), tc.exp)
68 }
69}
70
71func TestMaxGauges(t *testing.T) {
72 type testcase struct {

Callers

nothing calls this directly

Calls 2

checkFloatsFunction · 0.85
MinGaugesMethod · 0.80

Tested by

no test coverage detected