From 95bafc8caf5b206ecbe1adcb97d6571e5dbb41a9 Mon Sep 17 00:00:00 2001 From: dufucun Date: Fri, 30 Aug 2024 16:55:25 +0800 Subject: [PATCH] tests: fix slice init length (#6897) ### Describe Your Changes fix slice init length ### Checklist The following checks are **mandatory**: - [ ] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/). Signed-off-by: dufucun --- app/vmalert/rule/group_timing_test.go | 2 +- lib/streamaggr/streamaggr_timing_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmalert/rule/group_timing_test.go b/app/vmalert/rule/group_timing_test.go index c233ed34d..94399c490 100644 --- a/app/vmalert/rule/group_timing_test.go +++ b/app/vmalert/rule/group_timing_test.go @@ -11,7 +11,7 @@ import ( func BenchmarkGetStaleSeries(b *testing.B) { ts := time.Now() n := 100 - payload := make([]prompbmarshal.TimeSeries, n) + payload := make([]prompbmarshal.TimeSeries, 0, n) for i := 0; i < n; i++ { s := fmt.Sprintf("%d", i) labels := toPromLabels(b, diff --git a/lib/streamaggr/streamaggr_timing_test.go b/lib/streamaggr/streamaggr_timing_test.go index 5901e56ad..de7c49c1b 100644 --- a/lib/streamaggr/streamaggr_timing_test.go +++ b/lib/streamaggr/streamaggr_timing_test.go @@ -79,7 +79,7 @@ func newBenchAggregators(outputs []string, pushFunc PushFunc) *Aggregators { } func newBenchSeries(seriesCount int) []prompbmarshal.TimeSeries { - a := make([]string, seriesCount) + a := make([]string, 0, seriesCount) for j := 0; j < seriesCount; j++ { s := fmt.Sprintf(`http_requests_total{path="/foo/%d",job="foo_%d",instance="bar",pod="pod-123232312",namespace="kube-foo-bar",node="node-123-3434-443",`+ `some_other_label="foo-bar-baz",environment="prod",label1="value1",label2="value2",label3="value3"} %d`, j, j%100, j*1000)