From 9853888f9be07783e29a7df4ffe321a5f74ef560 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 5 Dec 2022 17:15:02 +0000 Subject: [PATCH] tsdb tests: allocate more reasonable sample slice Typical parameters are one hour by 1 minute step, where the function would allocate a slice of 3.6 million samples instead of 60. Signed-off-by: Bryan Boreham --- tsdb/block_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsdb/block_test.go b/tsdb/block_test.go index 799efbf85..6cb00b348 100644 --- a/tsdb/block_test.go +++ b/tsdb/block_test.go @@ -678,7 +678,7 @@ func genSeriesFromSampleGenerator(totalSeries, labelCount int, mint, maxt, step for j := 1; len(lbls) < labelCount; j++ { lbls[defaultLabelName+strconv.Itoa(j)] = defaultLabelValue + strconv.Itoa(j) } - samples := make([]tsdbutil.Sample, 0, maxt-mint+1) + samples := make([]tsdbutil.Sample, 0, (maxt-mint)/step+1) for t := mint; t < maxt; t += step { samples = append(samples, generator(t)) }