Skip to content

Commit

Permalink
test: add test for FlightSQL CLI client (#3816)
Browse files Browse the repository at this point in the history
* test: add test for FlightSQL CLI client

Closes #3814.

* refactor: improve test code

Co-authored-by: Andrew Lamb <[email protected]>

---------

Co-authored-by: Andrew Lamb <[email protected]>
  • Loading branch information
crepererum and alamb authored Mar 9, 2023
1 parent fb1dcc6 commit fb35d26
Show file tree
Hide file tree
Showing 3 changed files with 554 additions and 1 deletion.
6 changes: 6 additions & 0 deletions arrow-flight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cli = ["arrow/prettyprint", "clap", "tracing-log", "tracing-subscriber", "tonic/

[dev-dependencies]
arrow = { version = "34.0.0", path = "../arrow", features = ["prettyprint"] }
assert_cmd = "2.0.8"
tempfile = "3.3"
tokio-stream = { version = "0.1", features = ["net"] }
tower = "0.4.13"
Expand All @@ -78,3 +79,8 @@ required-features = ["flight-sql-experimental", "tls"]
[[bin]]
name = "flight_sql_client"
required-features = ["cli", "flight-sql-experimental", "tls"]

[[test]]
name = "flight_sql_client_cli"
path = "tests/flight_sql_client_cli.rs"
required-features = ["cli", "flight-sql-experimental", "tls"]
4 changes: 3 additions & 1 deletion arrow-flight/src/bin/flight_sql_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ fn setup_logging() {
async fn setup_client(args: ClientArgs) -> Result<FlightSqlServiceClient> {
let port = args.port.unwrap_or(if args.tls { 443 } else { 80 });

let mut endpoint = Endpoint::new(format!("https://{}:{}", args.host, port))
let protocol = if args.tls { "https" } else { "http" };

let mut endpoint = Endpoint::new(format!("{}://{}:{}", protocol, args.host, port))
.map_err(|_| ArrowError::IoError("Cannot create endpoint".to_string()))?
.connect_timeout(Duration::from_secs(20))
.timeout(Duration::from_secs(20))
Expand Down
Loading

0 comments on commit fb35d26

Please sign in to comment.