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 <dufuchun@sohu.com>
This commit is contained in:
dufucun 2024-08-30 16:55:25 +08:00 committed by GitHub
parent 334cd92a6c
commit 95bafc8caf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -11,7 +11,7 @@ import (
func BenchmarkGetStaleSeries(b *testing.B) { func BenchmarkGetStaleSeries(b *testing.B) {
ts := time.Now() ts := time.Now()
n := 100 n := 100
payload := make([]prompbmarshal.TimeSeries, n) payload := make([]prompbmarshal.TimeSeries, 0, n)
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
s := fmt.Sprintf("%d", i) s := fmt.Sprintf("%d", i)
labels := toPromLabels(b, labels := toPromLabels(b,

View file

@ -79,7 +79,7 @@ func newBenchAggregators(outputs []string, pushFunc PushFunc) *Aggregators {
} }
func newBenchSeries(seriesCount int) []prompbmarshal.TimeSeries { func newBenchSeries(seriesCount int) []prompbmarshal.TimeSeries {
a := make([]string, seriesCount) a := make([]string, 0, seriesCount)
for j := 0; j < seriesCount; j++ { 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",`+ 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) `some_other_label="foo-bar-baz",environment="prod",label1="value1",label2="value2",label3="value3"} %d`, j, j%100, j*1000)