From 27ecf8ebeade87e7136e3a92035e51ca4b3137fc Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Mon, 19 Oct 2026 15:42:35 +0800 Subject: [PATCH] test(promql): compile the Prometheus golden differential again `map/tests.rs` never declared `mod prometheus`, so `map/prometheus_cases.txt` and `map/tests/prometheus.rs` sat in the tree without being compiled: the golden cases evaluated by the real Prometheus engine, and the harness that runs them, were dead files. Nothing would have caught a drift from Prometheus in `map_math`. Declare the module again and adapt the harness to the `Option` return, dropping a series the kernel reports as having no float value. The harness asserts at least 48 math cases, so a future change that silently disables the fixture fails instead of passing with zero cases. Signed-off-by: discord9 Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --- src/promql/src/map/tests.rs | 2 ++ src/promql/src/map/tests/prometheus.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/promql/src/map/tests.rs b/src/promql/src/map/tests.rs index 63963761c57..c1a405d1d24 100644 --- a/src/promql/src/map/tests.rs +++ b/src/promql/src/map/tests.rs @@ -32,6 +32,8 @@ use datatypes::series::{Label, MetricName}; use super::*; use crate::functions::IeeeSqrt; +mod prometheus; + fn schema(names: &[&str]) -> SeriesSchema { SeriesSchema { fields: names diff --git a/src/promql/src/map/tests/prometheus.rs b/src/promql/src/map/tests/prometheus.rs index 05aada80070..ca9b7d43d03 100644 --- a/src/promql/src/map/tests/prometheus.rs +++ b/src/promql/src/map/tests/prometheus.rs @@ -225,7 +225,7 @@ fn math_matches_prometheus() { let output = case .series .iter() - .map(|series| map_math(&case.schema, series, op).unwrap()) + .filter_map(|series| map_math(&case.schema, series, op).unwrap()) .collect(); assert_result(case, output); matched += 1;