From 329f3399c4b8b1bf612052b88e55769a291f6d40 Mon Sep 17 00:00:00 2001 From: Tim Van Wassenhove Date: Wed, 27 Mar 2024 17:14:55 +0100 Subject: [PATCH] test: add test to verify that s3 console url works --- src/main.rs | 2 +- tests/integration.rs | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e8b794d..0fd67f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,7 +72,7 @@ async fn main() -> Result<()> { .register_object_store(&s3_url, Arc::new(OpendalStore::new(op))); } - let table_path = ListingTableUrl::parse(&args.path)?; + let table_path = ListingTableUrl::parse(data_path)?; let mut config = ListingTableConfig::new(table_path); config = config.infer_options(&ctx.state()).await?; config = config.infer_schema(&ctx.state()).await?; diff --git a/tests/integration.rs b/tests/integration.rs index d341582..0f94d4f 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -159,6 +159,36 @@ async fn run_with_s3_parquet_file() -> datafusion::common::Result<()> { .stdout(data_predicate); Ok(()) } + +#[tokio::test] +async fn run_with_s3_console_parquet_file() -> datafusion::common::Result<()> { + configure_minio(); + + let mut cmd = get_qv_cmd()?; + let cmd = cmd + .arg("https://s3.console.aws.amazon.com/s3/buckets/data?region=eu-central-1&prefix=iceberg/db/COVID-19_NYT/data/00000-2-2d39563f-6901-4e2d-9903-84a8eab8ac3d-00001.parquet&showversions=false") + .arg("-q") + .arg("select * from tbl order by date, county, state, fips, cases, deaths"); + + let header_predicate = + build_row_regex_predicate(vec!["date", "county", "state", "fips", "case", "deaths"]); + + let data_predicate = build_row_regex_predicate(vec![ + "2020-01-21", + "Snohomish", + "Washington", + "53061", + "1", + "0", + ]); + + cmd.assert() + .success() + .stdout(header_predicate) + .stdout(data_predicate); + Ok(()) +} + /* #[tokio::test] async fn run_with_s3_parquet_files_in_folder() -> datafusion::common::Result<()> {