-
Notifications
You must be signed in to change notification settings - Fork 513
test: add more test cases to improve test coverage for the write functionality in Lance #5619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
1304652 to
8335288
Compare
wjones127
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also changed the type in the PR title to test.
rust/lance/src/dataset/write.rs
Outdated
| #[tokio::test] | ||
| async fn test_stable_row_ids() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is already covered in test_new_row_ids and test_row_ids_append, right? If you think there's something missing in those test cases, can you add them there?
…ctionality in Lance
8335288 to
0f0d455
Compare
| // Empty stream should be handled gracefully | ||
| // It should create an empty dataset or return an appropriate result | ||
| match result { | ||
| Ok((fragments, _)) => { | ||
| // If successful, verify it creates an empty result | ||
| assert!( | ||
| fragments.is_empty(), | ||
| "Empty stream should create no fragments" | ||
| ); | ||
| } | ||
| Err(e) => { | ||
| // If it returns an error, verify it's an appropriate error type | ||
| let error_msg = e.to_string(); | ||
| assert!( | ||
| error_msg.contains("empty") | ||
| || error_msg.contains("no data") | ||
| || error_msg.contains("batch"), | ||
| "Error should mention empty or no data: {}", | ||
| error_msg | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test for one behavior; as it would be a breaking change to have one behavior and change to another.
An empty stream should output empty fragments.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This PR adds four new test cases to improve test coverage for the write functionality in Lance:
Changes
test_max_rows_per_file- Tests themax_rows_per_fileparameter behaviortest_max_rows_per_group- Testsmax_rows_per_groupparameter across different Lance file versionstest_empty_stream_write: Verifies graceful handling of empty input streams to prevent unexpected panics or cryptic errors.
test_schema_mismatch_on_append: Ensures clear error messages and data integrity when attempting to append data with incompatible schemas.
test_disk_full_error: Validates proper error propagation for storage-related failures to help users quickly identify and debug disk space issues.
test_write_interruption_recovery: Tests the complete transaction flow for interrupted writes, ensuring dataset consistency, data integrity, and successful retry capability.
Motivation
These tests improve confidence in the write functionality by covering important parameters and features that were previously untested or under-tested. They help prevent regressions and ensure correct behavior across different Lance file versions.