From d449d0a0e10c048e37667ebe3d109a1659cfe90e Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 9 Jul 2020 13:24:00 +0300 Subject: [PATCH] app/vmselect/promql: add missing tests for `ifnot` binary operation --- app/vmselect/promql/exec_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index 45859d9cde..3a2032c5f4 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -4209,6 +4209,23 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r} f(q, resultExpected) }) + t.Run(`ifnot`, func(t *testing.T) { + t.Parallel() + q := `time() ifnot time() > 1400` + r := netstorage.Result{ + MetricName: metricNameExpected, + Values: []float64{1000, 1200, 1400, nan, nan, nan}, + Timestamps: timestampsExpected, + } + resultExpected := []netstorage.Result{r} + f(q, resultExpected) + }) + t.Run(`ifnot-no-matching-timeseries`, func(t *testing.T) { + t.Parallel() + q := `label_set(time(), "foo", "bar") ifnot label_set(time() > 1400, "x", "y")` + resultExpected := []netstorage.Result{} + f(q, resultExpected) + }) t.Run(`quantile(-2)`, func(t *testing.T) { t.Parallel() q := `quantile(-2, label_set(10, "foo", "bar") or label_set(time()/150, "baz", "sss"))`