From d612dc8fe1606053747fde42f416ea13cc2749ed Mon Sep 17 00:00:00 2001 From: fmassot Date: Mon, 4 Dec 2023 09:54:39 +0100 Subject: [PATCH] Please clippy. --- quickwit/quickwit-serve/src/rest.rs | 34 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/quickwit/quickwit-serve/src/rest.rs b/quickwit/quickwit-serve/src/rest.rs index abd8a13ba02..64d41f58043 100644 --- a/quickwit/quickwit-serve/src/rest.rs +++ b/quickwit/quickwit-serve/src/rest.rs @@ -321,9 +321,11 @@ mod tests { use std::pin::Pin; use std::task::{Context, Poll}; + use async_trait::async_trait; use http::HeaderName; use hyper::{Request, Response, StatusCode}; use quickwit_cluster::{create_cluster_for_test, ChannelTransport}; + use quickwit_common::pubsub::{Event, EventBroker, EventSubscriber}; use quickwit_config::NodeConfig; use quickwit_index_management::IndexService; use quickwit_ingest::{IngestApiService, IngestServiceClient}; @@ -554,6 +556,21 @@ mod tests { } } + #[derive(Debug, Clone)] + struct MyEvent; + + impl Event for MyEvent {} + + #[derive(Debug, Clone)] + struct MySubscriber; + + #[async_trait] + impl EventSubscriber for MySubscriber { + async fn handle_event(&mut self, _event: MyEvent) { + // Do nothing. + } + } + #[tokio::test] async fn test_additional_headers() { let mut node_config = NodeConfig::for_test(); @@ -574,22 +591,25 @@ mod tests { let cluster = create_cluster_for_test(Vec::new(), &[], &transport, false) .await .unwrap(); + let event_broker = EventBroker::default(); + let subscription_handle = event_broker.subscribe(MySubscriber); let quickwit_services = QuickwitServices { + _report_splits_subscription_handle_opt: Some(subscription_handle), cluster, - _report_splits_subscription_handle_opt: None, control_plane_service, - ingester_service_opt: None, - metastore_server_opt: None, - index_manager: index_service, indexing_service_opt: None, - janitor_service_opt: None, - search_service: Arc::new(MockSearchService::new()), + index_manager: index_service, + ingest_service: ingest_service_client(), + + ingester_service_opt: None, ingest_router_service: IngestRouterServiceClient::from( IngestRouterServiceClient::mock(), ), - ingest_service: ingest_service_client(), + janitor_service_opt: None, metastore_client, + metastore_server_opt: None, node_config: Arc::new(node_config.clone()), + search_service: Arc::new(MockSearchService::new()), }; let handler = api_v1_routes(Arc::new(quickwit_services)); let resp = warp::test::request()