From 53105b99e77926e9145a900c31b2fc9e0ecc1e37 Mon Sep 17 00:00:00 2001 From: Yingwen Date: Thu, 22 Feb 2024 14:16:41 +0800 Subject: [PATCH] test: fix list_files_and_parse_table_name path issue on windows (#3349) * fix: always converts path to slash * chore: print * chore: normalize dir * chore: compile * chore: rm print --- Cargo.lock | 7 +++++++ src/operator/Cargo.toml | 1 + src/operator/src/statement/copy_database.rs | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 1d7b7cbf0e64..519b7af08e94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6066,6 +6066,7 @@ dependencies = [ "meter-macros", "object-store", "partition", + "path-slash", "prometheus", "query", "regex", @@ -6340,6 +6341,12 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + [[package]] name = "pathdiff" version = "0.2.1" diff --git a/src/operator/Cargo.toml b/src/operator/Cargo.toml index a6dc31b5c0f5..a09c505fd4b3 100644 --- a/src/operator/Cargo.toml +++ b/src/operator/Cargo.toml @@ -61,3 +61,4 @@ tonic.workspace = true [dev-dependencies] common-test-util.workspace = true +path-slash = "0.2" diff --git a/src/operator/src/statement/copy_database.rs b/src/operator/src/statement/copy_database.rs index 0ab4d09cf752..63236e3eb9f6 100644 --- a/src/operator/src/statement/copy_database.rs +++ b/src/operator/src/statement/copy_database.rs @@ -206,6 +206,7 @@ mod tests { use object_store::services::Fs; use object_store::util::normalize_dir; use object_store::ObjectStore; + use path_slash::PathExt; use table::requests::CopyDatabaseRequest; use crate::statement::copy_database::{list_files_to_copy, parse_file_name_to_copy}; @@ -223,10 +224,11 @@ mod tests { object_store.write("d", "").await.unwrap(); object_store.write("e.f.parquet", "").await.unwrap(); + let location = normalize_dir(&dir.path().to_slash().unwrap()); let request = CopyDatabaseRequest { catalog_name: "catalog_0".to_string(), schema_name: "schema_0".to_string(), - location: store_dir, + location, with: [("FORMAT".to_string(), "parquet".to_string())] .into_iter() .collect(),