adds tests for sum_over_time and avg_over_time

Signed-off-by: Neeraj Gartia <neerajgartia211002@gmail.com>
This commit is contained in:
Neeraj Gartia 2025-01-28 02:05:30 +05:30
parent 6ede900506
commit 21afc0beb4

View file

@ -810,6 +810,8 @@ load 10s
metric9 -9.988465674311579e+307 -9.988465674311579e+307 -9.988465674311579e+307
metric10 -9.988465674311579e+307 9.988465674311579e+307
metric11 1 2 3 NaN NaN
metric12 1 2 3 {{schema:0 sum:1 count:1}} {{schema:0 sum:3 count:3}}
metric13 {{schema:0 sum:1 count:1}}x5
eval instant at 55s avg_over_time(metric[1m])
{} 3
@ -916,6 +918,23 @@ eval instant at 1m avg_over_time(metric11[1m])
eval instant at 1m sum_over_time(metric11[1m])/count_over_time(metric11[1m])
{} NaN
# Tests for samples with mix of floats and histograms.
eval_warn instant at 1m sum_over_time(metric12[1m])
# no result.
eval_warn instant at 1m avg_over_time(metric12[1m])
# no result.
# Tests for samples with only histograms.
eval instant at 1m sum_over_time(metric13[1m])
{} {{schema:0 sum:5 count:5}}
eval instant at 1m avg_over_time(metric13[1m])
{} {{schema:0 sum:1 count:1}}
eval instant at 1m sum_over_time(metric13[1m])/count_over_time(metric13[1m])
{} {{schema:0 sum:1 count:1}}
# Test if very big intermediate values cause loss of detail.
clear
load 10s