emkornfield commented on code in PR #1876:
URL: https://github.com/apache/iceberg-rust/pull/1876#discussion_r2771227218
##########
crates/iceberg/src/spec/table_properties.rs:
##########
@@ -293,4 +429,178 @@ mod tests {
"Invalid value for write.target-file-size-bytes: invalid digit
found in string"
));
}
+
+ #[test]
+ fn test_table_properties_compression_lz4_rejected() {
+ let props = HashMap::from([(
+ TableProperties::PROPERTY_METADATA_COMPRESSION_CODEC.to_string(),
+ "lz4".to_string(),
+ )]);
+ let err = TableProperties::try_from(&props).unwrap_err();
+ assert!(
+ err.to_string()
+ .contains("Invalid metadata compression codec: lz4")
+ );
+ assert!(
+ err.to_string()
+ .contains("Only 'none' and 'gzip' are supported")
+ );
+ }
+
+ #[test]
+ fn test_table_properties_compression_zstd_rejected() {
+ let props = HashMap::from([(
+ TableProperties::PROPERTY_METADATA_COMPRESSION_CODEC.to_string(),
+ "zstd".to_string(),
+ )]);
+ let err = TableProperties::try_from(&props).unwrap_err();
+ assert!(
+ err.to_string()
+ .contains("Invalid metadata compression codec: zstd")
+ );
+ assert!(
+ err.to_string()
+ .contains("Only 'none' and 'gzip' are supported")
+ );
+ }
+
+ #[test]
+ fn test_table_properties_compression_invalid_rejected() {
+ let props = HashMap::from([(
+ TableProperties::PROPERTY_METADATA_COMPRESSION_CODEC.to_string(),
+ "snappy".to_string(),
+ )]);
+ let err = TableProperties::try_from(&props).unwrap_err();
+ assert!(
+ err.to_string()
+ .contains("Invalid metadata compression codec: snappy")
+ );
+ assert!(
+ err.to_string()
+ .contains("Only 'none' and 'gzip' are supported")
+ );
+ }
+
+ #[test]
+ fn test_parse_metadata_file_compression_valid() {
+ use super::parse_metadata_file_compression;
Review Comment:
need to move these imports out and clean up this code a little bit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]