diff --git a/promql/promqltest/testdata/aggregators.test b/promql/promqltest/testdata/aggregators.test index 2fee20e630..7698d5acaf 100644 --- a/promql/promqltest/testdata/aggregators.test +++ b/promql/promqltest/testdata/aggregators.test @@ -462,19 +462,34 @@ load 10s data{test="uneven samples",point="a"} 0 data{test="uneven samples",point="b"} 1 data{test="uneven samples",point="c"} 4 + data{test="NaN sample",point="a"} 0 + data{test="NaN sample",point="b"} 1 + data{test="NaN sample",point="c"} NaN data_histogram{test="histogram sample", point="c"} {{schema:2 count:4 sum:10 buckets:[1 0 0 0 1 0 0 1 1]}} foo 0 1 0 1 0 1 0.8 +# 80th percentile. +# The NaN sample is treated as the smallest possible value. eval instant at 1m quantile without(point)(0.8, data) {test="two samples"} 0.8 {test="three samples"} 1.6 {test="uneven samples"} 2.8 + {test="NaN sample"} 0.6 + +# 20th percentile. +# A quantile between NaN and 0 is interpolated as NaN. +eval instant at 1m quantile without(point)(0.2, data) + {test="two samples"} 0.2 + {test="three samples"} 0.4 + {test="uneven samples"} 0.4 + {test="NaN sample"} NaN # The histogram is ignored here so the result doesn't change but it has an info annotation now. eval_info instant at 1m quantile without(point)(0.8, {__name__=~"data(_histogram)?"}) {test="two samples"} 0.8 {test="three samples"} 1.6 {test="uneven samples"} 2.8 + {test="NaN sample"} 0.6 # The histogram is ignored here so there is no result but it has an info annotation now. eval_info instant at 1m quantile(0.8, data_histogram) @@ -484,24 +499,27 @@ eval instant at 1m quantile without(point)(scalar(foo), data) {test="two samples"} 0.8 {test="three samples"} 1.6 {test="uneven samples"} 2.8 - + {test="NaN sample"} 0.6 eval instant at 1m quantile without(point)((scalar(foo)), data) {test="two samples"} 0.8 {test="three samples"} 1.6 {test="uneven samples"} 2.8 + {test="NaN sample"} 0.6 eval instant at 1m quantile without(point)(NaN, data) expect warn msg: PromQL warning: quantile value should be between 0 and 1, got NaN - {test="two samples"} NaN - {test="three samples"} NaN - {test="uneven samples"} NaN + {test="two samples"} NaN + {test="three samples"} NaN + {test="uneven samples"} NaN + {test="NaN sample"} NaN # Bug #15971. eval range from 0m to 1m step 10s quantile without(point) (scalar(foo), data) {test="two samples"} 0 1 0 1 0 1 0.8 {test="three samples"} 0 2 0 2 0 2 1.6 {test="uneven samples"} 0 4 0 4 0 4 2.8 + {test="NaN sample"} NaN 1 NaN 1 NaN 1 0.6 # Tests for group. clear