From 3bdde3d339598ac8cd340cc7ced36da4ffdfec7b Mon Sep 17 00:00:00 2001 From: discord9 Date: Tue, 17 Nov 2026 12:01:04 +0800 Subject: [PATCH] test(query): prove a default engine option keeps native requests on the legacy route (#10459) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The engine-wide `experimental_native_promql` option is the outer gate. #10371 pinned its default, but nothing showed what that default does to a request that explicitly asks for the native route — which is the case that actually matters when the branch is merged back: a client can always send the per-request extension, and the engine option is the only thing left deciding. `plan_native_promql_with_query_options` always sets `query.experimental_native_promql=true` on the request, so passing `QueryOptions::default()` covers exactly that combination. The assertion looks at the rendered plan for both `FusedSeries` and `RawSeriesSource`, so a future change that lets the request alone admit the route fails here. Signed-off-by: discord9 --- src/query/src/planner.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/query/src/planner.rs b/src/query/src/planner.rs index 51dbebb3507..9d910e9782b 100644 --- a/src/query/src/planner.rs +++ b/src/query/src/planner.rs @@ -1557,6 +1557,30 @@ mod tests { } } + /// The engine-wide option is the outer gate: a request that asks for the native route is + /// still planned through the legacy path while `experimental_native_promql` keeps its + /// default. `plan_native_promql_with_query_options` always sets the request extension, so + /// passing `QueryOptions::default()` here is exactly that case. + #[tokio::test] + async fn test_default_engine_option_keeps_a_native_request_on_the_legacy_route() { + let plan = plan_native_promql_with_query_options( + crate::options::QueryOptions::default(), + None, + None, + ) + .await + .unwrap(); + + assert!( + !plan.contains("FusedSeries"), + "a default deployment planned natively: {plan}" + ); + assert!( + !plan.contains("RawSeriesSource"), + "a default deployment planned a raw-series source: {plan}" + ); + } + /// The fallback hint names a query option, so a value that is not a boolean is rejected instead /// of silently leaving the fallback off. #[tokio::test]