From 676eacfc4f8a42ba43d4cfb03d95cb13c819999f Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Sat, 27 Feb 2021 05:29:46 -0500 Subject: [PATCH 1/2] ARROW-11717: [Integration] Do not print server ready message until rust server is actually ready --- rust/integration-testing/src/flight_server_scenarios.rs | 2 -- .../src/flight_server_scenarios/auth_basic_proto.rs | 3 +++ .../src/flight_server_scenarios/integration_test.rs | 3 +++ .../src/flight_server_scenarios/middleware.rs | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/rust/integration-testing/src/flight_server_scenarios.rs b/rust/integration-testing/src/flight_server_scenarios.rs index d23480b3d04..9163b692086 100644 --- a/rust/integration-testing/src/flight_server_scenarios.rs +++ b/rust/integration-testing/src/flight_server_scenarios.rs @@ -32,8 +32,6 @@ pub async fn listen_on(port: &str) -> Result { let listener = TcpListener::bind(addr).await?; let addr = listener.local_addr()?; - // NOTE: Log output used in tests - println!("Server listening on localhost:{}", addr.port()); Ok(addr) } diff --git a/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs b/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs index 8e36dbc1baf..9478fda3567 100644 --- a/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs +++ b/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs @@ -47,6 +47,9 @@ pub async fn scenario_setup(port: &str) -> Result { let svc = FlightServiceServer::new(service); Server::builder().add_service(svc).serve(addr).await?; + + // NOTE: Log output used in tests to signal server is ready + println!("Server listening on localhost:{}", addr.port()); Ok(()) } diff --git a/rust/integration-testing/src/flight_server_scenarios/integration_test.rs b/rust/integration-testing/src/flight_server_scenarios/integration_test.rs index 6c0225d6b54..7f0198851b4 100644 --- a/rust/integration-testing/src/flight_server_scenarios/integration_test.rs +++ b/rust/integration-testing/src/flight_server_scenarios/integration_test.rs @@ -53,6 +53,9 @@ pub async fn scenario_setup(port: &str) -> Result { Server::builder().add_service(svc).serve(addr).await?; + // NOTE: Log output used in tests to signal server is ready + println!("Server listening on localhost:{}", addr.port()); + Ok(()) } diff --git a/rust/integration-testing/src/flight_server_scenarios/middleware.rs b/rust/integration-testing/src/flight_server_scenarios/middleware.rs index 5fdfa21ecaf..5394a18f36b 100644 --- a/rust/integration-testing/src/flight_server_scenarios/middleware.rs +++ b/rust/integration-testing/src/flight_server_scenarios/middleware.rs @@ -37,6 +37,9 @@ pub async fn scenario_setup(port: &str) -> Result { let addr = super::listen_on(port).await?; Server::builder().add_service(svc).serve(addr).await?; + + // NOTE: Log output used in tests to signal server is ready + println!("Server listening on localhost:{}", addr.port()); Ok(()) } From 492043ff253ce80ef00b406efb6e310a22447392 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Sat, 27 Feb 2021 15:35:52 -0500 Subject: [PATCH 2/2] print before await-ing --- .../src/flight_server_scenarios/auth_basic_proto.rs | 3 ++- .../src/flight_server_scenarios/integration_test.rs | 4 ++-- .../src/flight_server_scenarios/middleware.rs | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs b/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs index 9478fda3567..ea7ad3c3385 100644 --- a/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs +++ b/rust/integration-testing/src/flight_server_scenarios/auth_basic_proto.rs @@ -46,10 +46,11 @@ pub async fn scenario_setup(port: &str) -> Result { let addr = super::listen_on(port).await?; let svc = FlightServiceServer::new(service); - Server::builder().add_service(svc).serve(addr).await?; + let server = Server::builder().add_service(svc).serve(addr); // NOTE: Log output used in tests to signal server is ready println!("Server listening on localhost:{}", addr.port()); + server.await?; Ok(()) } diff --git a/rust/integration-testing/src/flight_server_scenarios/integration_test.rs b/rust/integration-testing/src/flight_server_scenarios/integration_test.rs index 7f0198851b4..ee42a47c9a4 100644 --- a/rust/integration-testing/src/flight_server_scenarios/integration_test.rs +++ b/rust/integration-testing/src/flight_server_scenarios/integration_test.rs @@ -51,11 +51,11 @@ pub async fn scenario_setup(port: &str) -> Result { }; let svc = FlightServiceServer::new(service); - Server::builder().add_service(svc).serve(addr).await?; + let server = Server::builder().add_service(svc).serve(addr); // NOTE: Log output used in tests to signal server is ready println!("Server listening on localhost:{}", addr.port()); - + server.await?; Ok(()) } diff --git a/rust/integration-testing/src/flight_server_scenarios/middleware.rs b/rust/integration-testing/src/flight_server_scenarios/middleware.rs index 5394a18f36b..1416acc4088 100644 --- a/rust/integration-testing/src/flight_server_scenarios/middleware.rs +++ b/rust/integration-testing/src/flight_server_scenarios/middleware.rs @@ -36,10 +36,11 @@ pub async fn scenario_setup(port: &str) -> Result { let svc = FlightServiceServer::new(service); let addr = super::listen_on(port).await?; - Server::builder().add_service(svc).serve(addr).await?; + let server = Server::builder().add_service(svc).serve(addr); // NOTE: Log output used in tests to signal server is ready println!("Server listening on localhost:{}", addr.port()); + server.await?; Ok(()) }