mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-18 12:08:35 +00:00
test(rust): cover Azure table URI separators (#3837)
## Root cause The former listing-database table URI builder used OS-native `Path::join` for object-store URIs. On Windows this inserted backslashes into `az://` table paths, so `table_names` found slash-delimited objects while `open_table` addressed a different key. The production path now builds URI paths with forward slashes after the equivalent S3 report was fixed in #2575, but #1072 remained open without Azure-specific regression coverage. ## Fix - Add Azure URI regression assertions at the Rust table URI construction boundary. - Cover connection bases both with and without a trailing slash, matching the behavior reported in #1072. - Verify the resulting table URI always uses forward slashes on every platform. ## Validation - `cargo fmt --all -- --check` - `cargo test --quiet -p lancedb --lib database::listing::tests::test_table_uri` - `cargo check --quiet --features remote --tests --examples` - `cargo clippy --quiet --features remote --tests --examples` - `cargo test --quiet --features remote --tests` (866 passed, 1 ignored) Fixes #1072 <!-- lance-gatekeeper-fix:v1 agent=7d385255a072ed89ddc3ff4d08f82218 generation=1 --> Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
c5f9efefe9
commit
2922c171f7
@@ -2342,7 +2342,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_table_uri() {
|
||||
let (_tempdir, db) = setup_database().await;
|
||||
let (_tempdir, mut db) = setup_database().await;
|
||||
|
||||
let mut pb = PathBuf::new();
|
||||
pb.push(db.uri.clone());
|
||||
@@ -2351,6 +2351,18 @@ mod tests {
|
||||
let expected = pb.to_str().unwrap();
|
||||
let uri = db.table_uri("test").ok().unwrap();
|
||||
assert_eq!(uri, expected);
|
||||
|
||||
// URI paths always use forward slashes, even on Windows. Using
|
||||
// `Path::join` here used to produce `az://container/prefix\\test.lance`,
|
||||
// which Azure treated as a different object from the table returned by
|
||||
// `table_names` (https://github.com/lancedb/lancedb/issues/1072).
|
||||
for base_uri in ["az://container/prefix", "az://container/prefix/"] {
|
||||
db.uri = base_uri.to_string();
|
||||
assert_eq!(
|
||||
db.table_uri("test").unwrap(),
|
||||
"az://container/prefix/test.lance"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Regression: connecting via a URL-style URI (which goes through
|
||||
|
||||
Reference in New Issue
Block a user