@@ -319,32 +319,15 @@ async fn get_query(
319319
320320fn parse_baseline_mode ( raw : Option < & str > ) -> Result < BaselineBootstrapMode , ApiError > {
321321 match raw {
322- None => Ok ( BaselineBootstrapMode :: Aggregate ) ,
323- Some ( "aggregate" ) | Some ( "AGGREGATE" ) => Ok ( BaselineBootstrapMode :: Aggregate ) ,
324- Some ( "last" ) | Some ( "LAST" ) => Ok ( BaselineBootstrapMode :: Last ) ,
322+ None | Some ( "aggregate" | "AGGREGATE" ) => Ok ( BaselineBootstrapMode :: Aggregate ) ,
323+ Some ( "last" | "LAST" ) => Ok ( BaselineBootstrapMode :: Last ) ,
325324 Some ( other) => Err ( ApiError :: BadRequest ( format ! (
326325 "Unsupported baseline_mode '{}'. Use 'aggregate' or 'last'" ,
327326 other
328327 ) ) ) ,
329328 }
330329}
331330
332- #[ cfg( test) ]
333- mod tests {
334- use super :: parse_baseline_mode;
335- use crate :: registry:: query_registry:: BaselineBootstrapMode ;
336-
337- #[ test]
338- fn test_parse_baseline_mode_defaults_to_aggregate ( ) {
339- assert_eq ! ( parse_baseline_mode( None ) . unwrap( ) , BaselineBootstrapMode :: Aggregate ) ;
340- }
341-
342- #[ test]
343- fn test_parse_baseline_mode_accepts_last ( ) {
344- assert_eq ! ( parse_baseline_mode( Some ( "last" ) ) . unwrap( ) , BaselineBootstrapMode :: Last ) ;
345- }
346- }
347-
348331/// POST /api/queries/:id/start - Start executing a query
349332async fn start_query (
350333 State ( state) : State < Arc < AppState > > ,
@@ -664,3 +647,19 @@ pub async fn start_server(
664647
665648 Ok ( ( ) )
666649}
650+
651+ #[ cfg( test) ]
652+ mod tests {
653+ use super :: parse_baseline_mode;
654+ use crate :: registry:: query_registry:: BaselineBootstrapMode ;
655+
656+ #[ test]
657+ fn test_parse_baseline_mode_defaults_to_aggregate ( ) {
658+ assert_eq ! ( parse_baseline_mode( None ) . unwrap( ) , BaselineBootstrapMode :: Aggregate ) ;
659+ }
660+
661+ #[ test]
662+ fn test_parse_baseline_mode_accepts_last ( ) {
663+ assert_eq ! ( parse_baseline_mode( Some ( "last" ) ) . unwrap( ) , BaselineBootstrapMode :: Last ) ;
664+ }
665+ }
0 commit comments