alamb commented on code in PR #6611:
URL: https://github.com/apache/arrow-rs/pull/6611#discussion_r1810766111
##########
arrow-integration-testing/src/flight_server_scenarios/integration_test.rs:
##########
@@ -48,9 +48,13 @@ type Result<T = (), E = Error> = std::result::Result<T, E>;
/// Run a scenario that tests integration testing.
pub async fn scenario_setup(port: u16) -> Result {
let addr = super::listen_on(port).await?;
+ let resolved_port = addr.port();
let service = FlightServiceImpl {
- server_location: format!("grpc+tcp://{addr}"),
+ // See https://github.com/apache/arrow-rs/issues/6577
Review Comment:
Do you know how to get the resolved address? I tried `addr.ip()` but that
still returns the unresolved port.
```rust
#[tokio::main]
async fn main() -> Result<(), DataFusionError> {
let port = 9999;
let addr: SocketAddr = format!("0.0.0.0:{port}").parse().unwrap();
let listener = TcpListener::bind(addr).unwrap();
let addr = listener.local_addr().unwrap();
println!("Listening on: {}", addr);
println!("Resolved host: {}", addr.ip().to_string());
println!("Resolved port: {}", addr.port());
Ok(())
}
```
Which prints out
```
Listening on: 0.0.0.0:9999
Resolved host: 0.0.0.0
Resolved port: 9999
```
I think only the actual `Server` knows the port after calling `listen`, but
the tower/tonic thing only returns some sort of future (not a server that can
be interrogated) 🤔
```rust
let server = Server::builder().add_service(svc).serve(addr);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]