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