test(query): prove a default engine option keeps native requests on the legacy route (#10459)

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 <discord9@163.com>
This commit is contained in:
discord9
2026-11-17 12:01:04 +08:00
committed by GitHub
parent 6796dfeaee
commit 3bdde3d339
+24
View File
@@ -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]