Add roundtrip serialization property tests for types in change sets file#1525
Conversation
paraseba
left a comment
There was a problem hiding this comment.
Looks great, a couple of minor comments
icechunk/src/strategies.rs
Outdated
|
|
||
| type SplitManifest = BTreeMap<ChunkIndices, Option<ChunkPayload>>; | ||
|
|
||
| pub fn chunk_indices2() -> impl Strategy<Value = ChunkIndices> { |
There was a problem hiding this comment.
why not using the existing strategy?
There was a problem hiding this comment.
I thought it would be an easier way to use the existing chunk_indices function by having the new function generate the inputs used for the old function.
icechunk/src/strategies.rs
Outdated
| } | ||
|
|
||
| pub fn split_manifest() -> impl Strategy<Value = SplitManifest> { | ||
| btree_map(chunk_indices2(), option::of(chunk_payload()), 3..10) |
There was a problem hiding this comment.
An issue here is that all chunk indices in a single split manifest should have the same number of dimensions
There was a problem hiding this comment.
I see. I will change this so all generated chunk indices are of the same size.
icechunk/src/strategies.rs
Outdated
| } | ||
|
|
||
| pub fn manifest_extents(ndim: usize) -> impl Strategy<Value = ManifestExtents> { | ||
| pub fn manifest_extents2(ndim: usize) -> impl Strategy<Value = ManifestExtents> { |
There was a problem hiding this comment.
Let's delete this function if we believe the new one is superior
There was a problem hiding this comment.
Although the new function is simpler, it does not work when used in the test_property_extents_widths test in manifest.rs.
I still have not figured out how to replicate the property that the test expects in the new function. That is why I left both versions of the function
There was a problem hiding this comment.
Do you happen to know why the delta values fall in [0, 99] for the test_property_extents_width test?
There was a problem hiding this comment.
Feel free to modify that test as needed. There is no profound reason for the values selected there.
There was a problem hiding this comment.
I see. Thank you for clarifying that.
icechunk/src/change_set.rs
Outdated
| use proptest::prelude::*; | ||
|
|
||
| prop_compose! { | ||
| fn edit_changes()(num_of_dims in any::<u16>().prop_map(usize::from))( |
There was a problem hiding this comment.
to make it more realistic let's keep number of dimensions in [1, 20]
There was a problem hiding this comment.
I see. I will shrink the range of values for num_of_dims.
icechunk/src/strategies.rs
Outdated
| } | ||
|
|
||
| pub fn manifest_extents(ndim: usize) -> impl Strategy<Value = ManifestExtents> { | ||
| pub fn manifest_extents2(ndim: usize) -> impl Strategy<Value = ManifestExtents> { |
There was a problem hiding this comment.
Feel free to modify that test as needed. There is no profound reason for the values selected there.
icechunk/src/strategies.rs
Outdated
|
|
||
| type SplitManifest = BTreeMap<ChunkIndices, Option<ChunkPayload>>; | ||
|
|
||
| // pub fn chunk_indices2() -> impl Strategy<Value = ChunkIndices> { |
There was a problem hiding this comment.
Ok. I will do that.
There was a problem hiding this comment.
I am sorry. I did not realize I forgot to delete the commented code
icechunk/src/strategies.rs
Outdated
| // .prop_flat_map(|(dim, data)| chunk_indices(dim, data)) | ||
| // } | ||
|
|
||
| pub fn chunk_indices2(dim: usize) -> impl Strategy<Value = ChunkIndices> { |
There was a problem hiding this comment.
maybe a name like large_chunk_indices
There was a problem hiding this comment.
That sounds good to me. I will apply that change.
ca70a53 to
7da443d
Compare
bd3bfe8 to
e7da217
Compare
| }) | ||
| } | ||
|
|
||
| pub fn manifest_extents(ndim: usize) -> impl Strategy<Value = ManifestExtents> { |
There was a problem hiding this comment.
Can we unify the two manifest_extents functions? Otherwise let's use better names and document the different between the two
There was a problem hiding this comment.
At the moment, I have not found a way to do so. I will change the names and add a docstring for each function.
icechunk/src/strategies.rs
Outdated
|
|
||
| type SplitManifest = BTreeMap<ChunkIndices, Option<ChunkPayload>>; | ||
|
|
||
| // pub fn chunk_indices2() -> impl Strategy<Value = ChunkIndices> { |
Summary
There are property tests in
icechunk/src/change_set.rswhich check that the composition of serializing and deserializing aChangeSetis equivalent to the identity function.Changes
icechunk/src/change_set.rs
ChangeSettypeChangeSettypeicechunk/src/format/manifest.rs
ManifestExtentsstrategy used for some of the testsicechunk/src/strategies.rs
ChangeSettype inicechunk/src/change_set.rsicechunk/src/storage/s3.rs