(t *testing.T)
| 26 | } |
| 27 | |
| 28 | func TestTestRegistry_histogram(t *testing.T) { |
| 29 | testRegistry := NewTestRegistry() |
| 30 | |
| 31 | histogram := testRegistry.NewHistogram("histogram", []float64{1.0, 2.0}, HistogramModeClassic) |
| 32 | |
| 33 | labelValues := buildTestLabels([]string{"foo", "bar"}, []string{"foo-value", "bar-value"}) |
| 34 | histogram.ObserveWithExemplar(labelValues, 1.0, "", 1.0) |
| 35 | histogram.ObserveWithExemplar(labelValues, 2.0, "", 1.0) |
| 36 | histogram.ObserveWithExemplar(labelValues, 2.5, "", 1.0) |
| 37 | |
| 38 | lbls := labels.FromMap(map[string]string{ |
| 39 | "foo": "foo-value", |
| 40 | "bar": "bar-value", |
| 41 | }) |
| 42 | assert.Equal(t, 1.0, testRegistry.Query("histogram_bucket", withLe(lbls, 1.0))) |
| 43 | assert.Equal(t, 2.0, testRegistry.Query("histogram_bucket", withLe(lbls, 2.0))) |
| 44 | assert.Equal(t, 3.0, testRegistry.Query("histogram_bucket", withLe(lbls, math.Inf(1)))) |
| 45 | assert.Equal(t, 3.0, testRegistry.Query("histogram_count", lbls)) |
| 46 | assert.Equal(t, 5.5, testRegistry.Query("histogram_sum", lbls)) |
| 47 | } |
nothing calls this directly
no test coverage detected