mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect/promql: updates tests for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3664
This commit is contained in:
parent
68463c9e87
commit
0c625185cb
1 changed files with 56 additions and 1 deletions
|
@ -86,6 +86,61 @@ func TestExecSuccess(t *testing.T) {
|
||||||
resultExpected := []netstorage.Result{r}
|
resultExpected := []netstorage.Result{r}
|
||||||
f(q, resultExpected)
|
f(q, resultExpected)
|
||||||
})
|
})
|
||||||
|
t.Run("duration-constant", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
q := `1h23m5S`
|
||||||
|
r := netstorage.Result{
|
||||||
|
MetricName: metricNameExpected,
|
||||||
|
Values: []float64{4985, 4985, 4985, 4985, 4985, 4985},
|
||||||
|
Timestamps: timestampsExpected,
|
||||||
|
}
|
||||||
|
resultExpected := []netstorage.Result{r}
|
||||||
|
f(q, resultExpected)
|
||||||
|
})
|
||||||
|
t.Run("num-with-suffix-1", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
q := `123M`
|
||||||
|
r := netstorage.Result{
|
||||||
|
MetricName: metricNameExpected,
|
||||||
|
Values: []float64{123e6, 123e6, 123e6, 123e6, 123e6, 123e6},
|
||||||
|
Timestamps: timestampsExpected,
|
||||||
|
}
|
||||||
|
resultExpected := []netstorage.Result{r}
|
||||||
|
f(q, resultExpected)
|
||||||
|
})
|
||||||
|
t.Run("num-with-suffix-2", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
q := `1.23TB`
|
||||||
|
r := netstorage.Result{
|
||||||
|
MetricName: metricNameExpected,
|
||||||
|
Values: []float64{1.23e12, 1.23e12, 1.23e12, 1.23e12, 1.23e12, 1.23e12},
|
||||||
|
Timestamps: timestampsExpected,
|
||||||
|
}
|
||||||
|
resultExpected := []netstorage.Result{r}
|
||||||
|
f(q, resultExpected)
|
||||||
|
})
|
||||||
|
t.Run("num-with-suffix-3", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
q := `1.23Mib`
|
||||||
|
r := netstorage.Result{
|
||||||
|
MetricName: metricNameExpected,
|
||||||
|
Values: []float64{1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20)},
|
||||||
|
Timestamps: timestampsExpected,
|
||||||
|
}
|
||||||
|
resultExpected := []netstorage.Result{r}
|
||||||
|
f(q, resultExpected)
|
||||||
|
})
|
||||||
|
t.Run("num-with-suffix-4", func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
q := `1.23mib`
|
||||||
|
r := netstorage.Result{
|
||||||
|
MetricName: metricNameExpected,
|
||||||
|
Values: []float64{1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20), 1.23 * (1 << 20)},
|
||||||
|
Timestamps: timestampsExpected,
|
||||||
|
}
|
||||||
|
resultExpected := []netstorage.Result{r}
|
||||||
|
f(q, resultExpected)
|
||||||
|
})
|
||||||
t.Run("simple-arithmetic", func(t *testing.T) {
|
t.Run("simple-arithmetic", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
q := `-1+2 *3 ^ 4+5%6`
|
q := `-1+2 *3 ^ 4+5%6`
|
||||||
|
@ -7357,7 +7412,7 @@ func TestExecSuccess(t *testing.T) {
|
||||||
})
|
})
|
||||||
t.Run(`rollup_scrape_interval()`, func(t *testing.T) {
|
t.Run(`rollup_scrape_interval()`, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
q := `sort_by_label(rollup_scrape_interval(1[5M:10s]), "rollup")`
|
q := `sort_by_label(rollup_scrape_interval(1[5m:10S]), "rollup")`
|
||||||
r1 := netstorage.Result{
|
r1 := netstorage.Result{
|
||||||
MetricName: metricNameExpected,
|
MetricName: metricNameExpected,
|
||||||
Values: []float64{10, 10, 10, 10, 10, 10},
|
Values: []float64{10, 10, 10, 10, 10, 10},
|
||||||
|
|
Loading…
Reference in a new issue