mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-17 02:15:28 +00:00
fix(scanner): canonicalize temp_dir for drive field assertion on macOS
On macOS, /var is a symlink to /private/var. The scanner's local_disk.path() returns the canonicalized path, but tempfile::tempdir() returns the non-canonical /var/... path. This caused the drive field assertion in test_scan_folder_corrupt_xl_meta_stops_erasure_data_dir_descent to fail with a path mismatch. Fix by canonicalizing temp_dir only for the drive field comparison, while keeping the non-canonical path for metadata_path and failed_objects which use the original directory walk paths.
This commit is contained in:
@@ -4621,6 +4621,8 @@ mod tests {
|
||||
let _subscriber_guard = tracing::subscriber::set_default(subscriber);
|
||||
|
||||
let (mut scanner, temp_dir) = build_test_scanner().await;
|
||||
// Canonicalize for the "drive" field comparison (scanner resolves symlinks).
|
||||
let canonical_temp_dir = std::fs::canonicalize(&temp_dir).unwrap_or_else(|_| temp_dir.clone());
|
||||
let _guard = TestGuard::new(60, 100, &mut scanner, temp_dir.clone());
|
||||
|
||||
let object_dir = temp_dir.join("bucket").join("object");
|
||||
@@ -4689,7 +4691,7 @@ mod tests {
|
||||
let fields = &events[0]["fields"];
|
||||
assert_eq!(fields["component"], LOG_COMPONENT_SCANNER);
|
||||
assert_eq!(fields["subsystem"], LOG_SUBSYSTEM_FOLDER);
|
||||
assert_eq!(fields["drive"], temp_dir.to_string_lossy().as_ref());
|
||||
assert_eq!(fields["drive"], canonical_temp_dir.to_string_lossy().as_ref());
|
||||
assert_eq!(fields["bucket"], "bucket");
|
||||
assert_eq!(fields["object"], "object");
|
||||
assert_eq!(fields["metadata_path"], metadata_path.to_string_lossy().as_ref());
|
||||
|
||||
Reference in New Issue
Block a user