From 82ebddbc10e51e5b5244af3d4631f4120f9da508 Mon Sep 17 00:00:00 2001 From: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 12:07:38 +0000 Subject: [PATCH] test(rust): preserve UNC authority in lifecycle test --- rust/lancedb/src/database/listing.rs | 17 +++++++++++++++-- rust/lancedb/src/io/object_store.rs | 5 +++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/rust/lancedb/src/database/listing.rs b/rust/lancedb/src/database/listing.rs index a455a5fae..4f38975ce 100644 --- a/rust/lancedb/src/database/listing.rs +++ b/rust/lancedb/src/database/listing.rs @@ -1658,9 +1658,22 @@ mod tests { }; let drive_root = PathBuf::from(format!("{}:\\", drive as char)); let relative = tempdir.path().strip_prefix(&drive_root).unwrap(); - let unc_path = PathBuf::from(format!(r"\\localhost\{}$", drive as char)).join(relative); + // `url` treats `localhost` as an empty file-URL authority, turning + // `file://localhost/C$/...` into the invalid drive-relative + // `file:///C$/...`. Use the machine's actual network name so this + // remains a genuine UNC URL throughout the connection lifecycle. + let Some(computer_name) = std::env::var_os("COMPUTERNAME") else { + eprintln!("skipping UNC lifecycle test because COMPUTERNAME is unavailable"); + return; + }; + let unc_path = PathBuf::from(format!( + r"\\{}\{}$", + computer_name.to_string_lossy(), + drive as char + )) + .join(relative); if !unc_path.try_exists().unwrap_or(false) { - eprintln!("skipping UNC lifecycle test because the localhost admin share is disabled"); + eprintln!("skipping UNC lifecycle test because the local admin share is unavailable"); return; } let uri = url::Url::from_directory_path(&unc_path) diff --git a/rust/lancedb/src/io/object_store.rs b/rust/lancedb/src/io/object_store.rs index 90ba560ca..b92befa76 100644 --- a/rust/lancedb/src/io/object_store.rs +++ b/rust/lancedb/src/io/object_store.rs @@ -27,10 +27,11 @@ use async_trait::async_trait; #[cfg(any(windows, test))] use lance_core::{Error as LanceError, Result as LanceResult}; +#[cfg(test)] +use lance_io::object_store::ObjectStoreRegistry; #[cfg(any(windows, test))] use lance_io::object_store::{ - DEFAULT_LOCAL_IO_PARALLELISM, ObjectStoreParams, ObjectStoreProvider, ObjectStoreRegistry, - StorageOptions, + DEFAULT_LOCAL_IO_PARALLELISM, ObjectStoreParams, ObjectStoreProvider, StorageOptions, }; #[cfg(any(windows, test))] use object_store::local::LocalFileSystem;