From a0b7def89d287da047cfe22918331a009e071439 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 20 Jul 2023 21:25:30 -0700 Subject: [PATCH] app/vmselect/promql: fix tests after 781947a7e293417324ad482c6e505c5020f19fa6 --- app/vmselect/promql/exec_test.go | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index ff76b55287..d06a8cf3ad 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -3017,23 +3017,21 @@ func TestExecSuccess(t *testing.T) { t.Parallel() q := `sort_desc(((label_set(time(), "foo", "bar", "__name__", "q1") or label_set(10, "foo", "qwert", "__name__", "q2")) / 2) keep_metric_names)` r1 := netstorage.Result{ - MetricName: storage.MetricName{ - MetricGroup: []byte("q1"), - }, + MetricName: metricNameExpected, Values: []float64{500, 600, 700, 800, 900, 1000}, Timestamps: timestampsExpected, } + r1.MetricName.MetricGroup = []byte("q1") r1.MetricName.Tags = []storage.Tag{{ Key: []byte("foo"), Value: []byte("bar"), }} r2 := netstorage.Result{ - MetricName: storage.MetricName{ - MetricGroup: []byte("q2"), - }, + MetricName: metricNameExpected, Values: []float64{5, 5, 5, 5, 5, 5}, Timestamps: timestampsExpected, } + r2.MetricName.MetricGroup = []byte("q2") r2.MetricName.Tags = []storage.Tag{{ Key: []byte("foo"), Value: []byte("qwert"), @@ -3080,23 +3078,21 @@ func TestExecSuccess(t *testing.T) { t.Parallel() q := `sort_desc(2 * (label_set(time(), "foo", "bar", "__name__", "q1"), label_set(10, "foo", "qwert", "__name__", "q2")) keep_metric_names)` r1 := netstorage.Result{ - MetricName: storage.MetricName{ - MetricGroup: []byte("q1"), - }, + MetricName: metricNameExpected, Values: []float64{2000, 2400, 2800, 3200, 3600, 4000}, Timestamps: timestampsExpected, } + r1.MetricName.MetricGroup = []byte("q1") r1.MetricName.Tags = []storage.Tag{{ Key: []byte("foo"), Value: []byte("bar"), }} r2 := netstorage.Result{ - MetricName: storage.MetricName{ - MetricGroup: []byte("q2"), - }, + MetricName: metricNameExpected, Values: []float64{20, 20, 20, 20, 20, 20}, Timestamps: timestampsExpected, } + r2.MetricName.MetricGroup = []byte("q2") r2.MetricName.Tags = []storage.Tag{{ Key: []byte("foo"), Value: []byte("qwert"), @@ -3132,23 +3128,21 @@ func TestExecSuccess(t *testing.T) { t.Parallel() q := `sort_desc(2 * on() group_right() (label_set(time(), "foo", "bar", "__name__", "q1"), label_set(10, "foo", "qwert", "__name__", "q2")) keep_metric_names)` r1 := netstorage.Result{ - MetricName: storage.MetricName{ - MetricGroup: []byte("q1"), - }, + MetricName: metricNameExpected, Values: []float64{2000, 2400, 2800, 3200, 3600, 4000}, Timestamps: timestampsExpected, } + r1.MetricName.MetricGroup = []byte("q1") r1.MetricName.Tags = []storage.Tag{{ Key: []byte("foo"), Value: []byte("bar"), }} r2 := netstorage.Result{ - MetricName: storage.MetricName{ - MetricGroup: []byte("q2"), - }, + MetricName: metricNameExpected, Values: []float64{20, 20, 20, 20, 20, 20}, Timestamps: timestampsExpected, } + r2.MetricName.MetricGroup = []byte("q2") r2.MetricName.Tags = []storage.Tag{{ Key: []byte("foo"), Value: []byte("qwert"),