mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
app/vmselect/promql: updates tests for https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3664
This commit is contained in:
parent
0ddde652e6
commit
29aa6a67da
1 changed files with 56 additions and 1 deletions
|
@ -95,6 +95,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`
|
||||||
|
@ -7232,7 +7287,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