diff --git a/kernel/src/path.rs b/kernel/src/path.rs index bdb443509..2fe9ae7d3 100644 --- a/kernel/src/path.rs +++ b/kernel/src/path.rs @@ -216,8 +216,19 @@ mod tests { // ignored - no extension let log_path = table_log_dir.join("00000000000000000010").unwrap(); - let log_path = ParsedLogPath::try_from(log_path).unwrap(); - assert!(log_path.is_none()); + let result = ParsedLogPath::try_from(log_path); + assert!( + matches!(result, Ok(None)), + "Expected Ok(None) for missing file extension" + ); + + // empty extension - should be treated as unknown file type + let log_path = table_log_dir.join("00000000000000000011.").unwrap(); + let result = ParsedLogPath::try_from(log_path); + assert!(matches!(result, Ok(Some(_))), "Expected Ok(Some) for empty extension"); + if let Ok(Some(parsed)) = result { + assert!(parsed.is_unknown(), "Expected Unknown file type for empty extension"); + } // ignored - version fails to parse let log_path = table_log_dir.join("abc.json").unwrap(); @@ -322,6 +333,17 @@ mod tests { )); assert!(!log_path.is_commit()); + // Boundary test - UUID with exactly 35 characters (one too short) + let log_path = table_log_dir + .join("00000000000000000010.checkpoint.3a0d65cd-4056-49b8-937b-95f9e3ee90e.parquet") + .unwrap(); + let result = ParsedLogPath::try_from(log_path); + assert!(result.is_err(), "Expected an error for UUID with exactly 35 characters"); + assert!( + matches!(result, Err(Error::InvalidLogPath(_))), + "Expected InvalidLogPath error for boundary UUID length" + ); + // TODO: Support v2 checkpoints! Until then we can't treat these as checkpoint files. assert!(!log_path.is_checkpoint()); assert!(log_path.is_unknown());