From 1db43792dbc2308747636f201649e6e7ede4ff6d Mon Sep 17 00:00:00 2001 From: beorn7 Date: Tue, 13 Nov 2018 15:48:48 +0100 Subject: [PATCH] Expose bug #494 Signed-off-by: beorn7 --- prometheus/testutil/testutil_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/prometheus/testutil/testutil_test.go b/prometheus/testutil/testutil_test.go index e25b1306f..0b8cf0934 100644 --- a/prometheus/testutil/testutil_test.go +++ b/prometheus/testutil/testutil_test.go @@ -143,6 +143,28 @@ func TestCollectAndCompare(t *testing.T) { } } +func TestCollectAndCompareNoLabel(t *testing.T) { + const metadata = ` + # HELP some_total A value that represents a counter. + # TYPE some_total counter + ` + + c := prometheus.NewCounter(prometheus.CounterOpts{ + Name: "some_total", + Help: "A value that represents a counter.", + }) + c.Inc() + + expected := ` + + some_total 1 + ` + + if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil { + t.Errorf("unexpected collecting result:\n%s", err) + } +} + func TestNoMetricFilter(t *testing.T) { const metadata = ` # HELP some_total A value that represents a counter.