From 2ae8c2bd3d91519b0b342897d1f1e6dc64496348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Mon, 21 Aug 2023 13:55:13 +0200 Subject: [PATCH] Set expected values in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The parsing doesn't seem to be perfect as I don't get all classic buckets possibly another bug found? Signed-off-by: György Krajcsovits --- scrape/scrape_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scrape/scrape_test.go b/scrape/scrape_test.go index 1a3d83755..3a5d3df06 100644 --- a/scrape/scrape_test.go +++ b/scrape/scrape_test.go @@ -2217,6 +2217,14 @@ metric: < `, scrapeClassicHistograms: true, contentType: "application/vnd.google.protobuf", + floats: []floatSample{ + {metric: labels.FromStrings("__name__", "test_histogram_count"), t: 1234568, f: 175}, + {metric: labels.FromStrings("__name__", "test_histogram_sum"), t: 1234568, f: 0.0008280461746287094}, + {metric: labels.FromStrings("__name__", "test_histogram_bucket", "le", "-0.0004899999999999998"), t: 1234568, f: 2}, + // {metric: labels.FromStrings("__name__", "test_histogram_bucket", "le", "-0.0003899999999999998"), t: 1234568, f: 4}, + // {metric: labels.FromStrings("__name__", "test_histogram_bucket", "le", "-0.0002899999999999998"), t: 1234568, f: 16}, + {metric: labels.FromStrings("__name__", "test_histogram_bucket", "le", "+Inf"), t: 1234568, f: 175}, + }, histograms: []histogramSample{{ t: 1234568, h: &histogram.Histogram{ @@ -2240,6 +2248,8 @@ metric: < exemplars: []exemplar.Exemplar{ {Labels: labels.FromStrings("dummyID", "59727"), Value: -0.00039, Ts: 1625851155146, HasTs: true}, {Labels: labels.FromStrings("dummyID", "5617"), Value: -0.00029, Ts: 1234568, HasTs: false}, + {Labels: labels.FromStrings("dummyID", "59727"), Value: -0.00039, Ts: 1625851155146, HasTs: true}, + {Labels: labels.FromStrings("dummyID", "5617"), Value: -0.00029, Ts: 1234568, HasTs: false}, }, }, } @@ -2278,6 +2288,9 @@ metric: < now := time.Now() for i := range test.floats { + if test.floats[i].t != 0 { + continue + } test.floats[i].t = timestamp.FromTime(now) }