flight_test_integration_client/
flight-test-integration-client.rs1#![allow(unused_crate_dependencies)]
22
23use arrow_integration_testing::flight_client_scenarios;
24use clap::Parser;
25type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
26type Result<T = (), E = Error> = std::result::Result<T, E>;
27
28#[derive(clap::ValueEnum, Debug, Clone)]
29enum Scenario {
30 Middleware,
31 #[clap(name = "auth:basic_proto")]
32 AuthBasicProto,
33}
34
35#[derive(Debug, Parser)]
36#[clap(author, version, about("rust flight-test-integration-client"), long_about = None)]
37struct Args {
38 #[clap(long, help = "host of flight server")]
39 host: String,
40 #[clap(long, help = "port of flight server")]
41 port: u16,
42 #[clap(
43 short,
44 long,
45 help = "path to the descriptor file, only used when scenario is not provided. See https://arrow.apache.org/docs/format/Integration.html#json-test-data-format"
46 )]
47 path: Option<String>,
48 #[clap(long, value_enum)]
49 scenario: Option<Scenario>,
50}
51
52#[tokio::main]
53async fn main() -> Result {
54 #[cfg(feature = "logging")]
55 tracing_subscriber::fmt::init();
56
57 let args = Args::parse();
58 let host = args.host;
59 let port = args.port;
60
61 match args.scenario {
62 Some(Scenario::Middleware) => {
63 flight_client_scenarios::middleware::run_scenario(&host, port).await?
64 }
65 Some(Scenario::AuthBasicProto) => {
66 flight_client_scenarios::auth_basic_proto::run_scenario(&host, port).await?
67 }
68 None => {
69 let path = args.path.expect("No path is given");
70 flight_client_scenarios::integration_test::run_scenario(&host, port, &path).await?;
71 }
72 }
73
74 Ok(())
75}