From 030835560b720d1b35cb75f494bd1d123a0c5f2d Mon Sep 17 00:00:00 2001 From: Kapil Lamba Date: Sat, 21 Jun 2025 18:40:57 +0530 Subject: [PATCH] promqltest: add/remove explicit annotation expectations to relevant tests Signed-off-by: Kapil Lamba --- promql/promqltest/testdata/at_modifier.test | 2 -- promql/promqltest/testdata/functions.test | 5 +++++ promql/promqltest/testdata/limit.test | 8 ++++++-- promql/promqltest/testdata/operators.test | 4 ++++ promql/promqltest/testdata/subquery.test | 2 ++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/promql/promqltest/testdata/at_modifier.test b/promql/promqltest/testdata/at_modifier.test index 754eeb9285..4091f7eabf 100644 --- a/promql/promqltest/testdata/at_modifier.test +++ b/promql/promqltest/testdata/at_modifier.test @@ -90,9 +90,7 @@ eval instant at 25s sum_over_time(metric{job="1"}[100] offset 50s @ 100) eval instant at 25s metric{job="1"} @ 50 + metric{job="1"} @ 100 {job="1"} 15 -# Note that this triggers an info annotation because we are rate'ing a metric that does not end in `_total`. eval instant at 25s rate(metric{job="1"}[100s] @ 100) + label_replace(rate(metric{job="2"}[123s] @ 200), "job", "1", "", "") - expect info {job="1"} 0.3 eval instant at 25s sum_over_time(metric{job="1"}[100s] @ 100) + label_replace(sum_over_time(metric{job="2"}[100s] @ 100), "job", "1", "", "") diff --git a/promql/promqltest/testdata/functions.test b/promql/promqltest/testdata/functions.test index 5c476912f3..24a21465b2 100644 --- a/promql/promqltest/testdata/functions.test +++ b/promql/promqltest/testdata/functions.test @@ -370,7 +370,10 @@ eval instant at 100m deriv(testcounter_reset_middle_mix[110m]) {} 0.010606060606060607 # deriv should silently ignore ranges consisting only of histograms. +# expects both an empty result and no info/warn annotations. eval instant at 50m deriv(http_requests_histogram[60m]) + expect no_info + expect no_warn #empty # deriv should return NaN in case of +Inf or -Inf found. @@ -423,6 +426,8 @@ eval instant at 60m predict_linear(testcounter_reset_middle_mix[60m], 50m) # predict_linear should silently ignore ranges consisting only of histograms. eval instant at 60m predict_linear(http_requests_histogram[60m], 50m) + expect no_info + expect no_warn #empty # predict_linear should return NaN in case of +Inf or -Inf found. diff --git a/promql/promqltest/testdata/limit.test b/promql/promqltest/testdata/limit.test index 484760cc85..3af8d3b364 100644 --- a/promql/promqltest/testdata/limit.test +++ b/promql/promqltest/testdata/limit.test @@ -15,10 +15,14 @@ load 5m bar 0 1 0 -1 0 1 0 -1 0 1 0 eval instant at 50m count(limitk by (group) (0, http_requests)) -# empty + expect no_info + expect no_warn + # empty eval instant at 50m count(limitk by (group) (-1, http_requests)) -# empty + expect no_info + expect no_warn + # empty # Exercise k==1 special case (as sample is added before the main series loop). eval instant at 50m count(limitk by (group) (1, http_requests) and http_requests) diff --git a/promql/promqltest/testdata/operators.test b/promql/promqltest/testdata/operators.test index 1d71acba16..cc4a053624 100644 --- a/promql/promqltest/testdata/operators.test +++ b/promql/promqltest/testdata/operators.test @@ -533,6 +533,8 @@ eval range from 0 to 60m step 6m left_floats == bool right_floats {} 0 _ _ _ 1 _ 0 0 0 1 1 eval range from 0 to 60m step 6m left_floats == does_not_match + expect no_info + expect no_info # No results. eval range from 0 to 24m step 6m left_histograms == right_histograms @@ -816,6 +818,8 @@ eval range from 0 to 60m step 6m Inf == bool left_floats {} 0 0 _ _ 0 _ 0 0 0 1 0 eval range from 0 to 60m step 6m NaN == left_floats + expect no_info + expect no_warn # No results. eval range from 0 to 60m step 6m NaN == bool left_floats diff --git a/promql/promqltest/testdata/subquery.test b/promql/promqltest/testdata/subquery.test index 8c7c178b85..f803dba349 100644 --- a/promql/promqltest/testdata/subquery.test +++ b/promql/promqltest/testdata/subquery.test @@ -156,4 +156,6 @@ load 5m foo 3+0x10 eval instant at 12m min_over_time((topk(1, foo))[1m:5m]) + expect no_info + expect no_warn #empty