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
This commit is contained in:
Yingwen
2024-02-22 14:16:41 +08:00
committed by GitHub
parent 564fe3beca
commit 53105b99e7
3 changed files with 11 additions and 1 deletions

7
Cargo.lock generated
View File

@@ -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"

View File

@@ -61,3 +61,4 @@ tonic.workspace = true
[dev-dependencies]
common-test-util.workspace = true
path-slash = "0.2"

View File

@@ -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(),