Skip to content

Commit

Permalink
Add boundary test for UUID length and empty extension case
Browse files Browse the repository at this point in the history
This commit enhances the Delta Lake log path parsing tests by:

1. Adding explicit boundary test for UUID length validation:
   - Tests UUID with exactly 35 characters (one too short)
   - Makes length requirements clearer for future maintainers

2. Adding test case for empty extension:
   - Verifies that paths ending with just a dot (e.g., "version.")
     are parsed as Ok(Some) with Unknown file type
   - Previously uncovered edge case

3. Adding integration test for invalid version propagation:
   - Verifies that Snapshot creation properly propagates InvalidLogPath
     errors from the log parsing layer

These changes improve test coverage of edge cases and make
requirements more explicit in the test suite.
  • Loading branch information
hackintoshrao committed Nov 13, 2024
1 parent 362372a commit c3653e5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions kernel/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ mod tests {

// Test cases for UUID_PART_LEN (36 characters)
let test_cases = vec![
// Error expected: UUID is 35 characters, but should be 36
// Error expected: UUID is exactly 35 characters (one too short)
(
"00000000000000000010.checkpoint.3a0d65cd-4056-49b8-937b-95f9e3ee90.parquet",
"00000000000000000010.checkpoint.3a0d65cd-4056-49b8-937b-95f9e3ee90e.parquet",
"short UUID",
),
// Error expected: UUID is 37 characters, but should be 36
// Error expected: UUID is 37 characters (one too long)
(
"00000000000000000010.checkpoint.3a0d65cd-4056-49b8-937b-95f9e3ee90e5a.parquet",
"long UUID",
Expand All @@ -281,6 +281,7 @@ mod tests {
);
}
}
#[test]
fn test_unknown_invalid_patterns() {
let table_log_dir = table_log_dir_url();

Expand Down Expand Up @@ -332,6 +333,14 @@ mod tests {
assert_eq!(log_path.extension, "foo");
assert_eq!(log_path.version, 10);
assert!(log_path.is_unknown());

// Test case for empty extension (should return Ok(Some) with 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");
}
}

#[test]
Expand Down

0 comments on commit c3653e5

Please # to comment.