mirror of
https://github.com/prometheus/prometheus.git
synced 2026-05-25 02:32:17 -04:00
test(promql): some functions silently ignore native histograms
Functions that silently ignore native histograms, not covered by existing tests: abs(), ceil(), clamp(), clamp_min(), clamp_max(), floor(), round(). Ref: https://github.com/prometheus/prometheus/pull/15845 Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
parent
665d1ba0cc
commit
9097f8f4e7
1 changed files with 62 additions and 1 deletions
63
promql/promqltest/testdata/functions.test
vendored
63
promql/promqltest/testdata/functions.test
vendored
|
|
@ -492,6 +492,7 @@ load 5m
|
|||
test_clamp{src="clamp-a"} -50
|
||||
test_clamp{src="clamp-b"} 0
|
||||
test_clamp{src="clamp-c"} 100
|
||||
test_clamp{src="histogram"} {{schema:0 sum:1 count:1}}
|
||||
|
||||
eval instant at 0m clamp_max(test_clamp, 75)
|
||||
{src="clamp-a"} -50
|
||||
|
|
@ -1209,7 +1210,67 @@ eval instant at 1m count_over_time({__name__=~"data(_histogram)?"}[2m])
|
|||
|
||||
clear
|
||||
|
||||
# Test for absent()
|
||||
# Test for abs, ceil(), floor(), round().
|
||||
|
||||
load 5m
|
||||
data{type="positive"} 2.5
|
||||
data{type="whole"} 2
|
||||
data{type="negative"} -2.5
|
||||
data{type="nwhole"} -2
|
||||
data{type="zero"} 0
|
||||
data{type="nzero"} -0
|
||||
data{type="inf"} +Inf
|
||||
data{type="ninf"} -Inf
|
||||
data{type="nan"} NaN
|
||||
data{type="histogram"} {{schema:0 sum:1 count:1}}
|
||||
|
||||
eval instant at 0m abs(data)
|
||||
{type="positive"} 2.5
|
||||
{type="whole"} 2
|
||||
{type="negative"} 2.5
|
||||
{type="nwhole"} 2
|
||||
{type="zero"} 0
|
||||
{type="nzero"} 0
|
||||
{type="inf"} +Inf
|
||||
{type="ninf"} +Inf
|
||||
{type="nan"} NaN
|
||||
|
||||
eval instant at 0m ceil(data)
|
||||
{type="positive"} 3
|
||||
{type="whole"} 2
|
||||
{type="negative"} -2
|
||||
{type="nwhole"} -2
|
||||
{type="zero"} 0
|
||||
{type="nzero"} 0
|
||||
{type="inf"} +Inf
|
||||
{type="ninf"} -Inf
|
||||
{type="nan"} NaN
|
||||
|
||||
eval instant at 0m floor(data)
|
||||
{type="positive"} 2
|
||||
{type="whole"} 2
|
||||
{type="negative"} -3
|
||||
{type="nwhole"} -2
|
||||
{type="zero"} 0
|
||||
{type="nzero"} 0
|
||||
{type="inf"} +Inf
|
||||
{type="ninf"} -Inf
|
||||
{type="nan"} NaN
|
||||
|
||||
eval instant at 0m round(data)
|
||||
{type="positive"} 3
|
||||
{type="whole"} 2
|
||||
{type="negative"} -2
|
||||
{type="nwhole"} -2
|
||||
{type="zero"} 0
|
||||
{type="nzero"} 0
|
||||
{type="inf"} +Inf
|
||||
{type="ninf"} -Inf
|
||||
{type="nan"} NaN
|
||||
|
||||
clear
|
||||
|
||||
# Test for absent().
|
||||
eval instant at 50m absent(nonexistent)
|
||||
{} 1
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue