Standing-Man commented on code in PR #1960:
URL: https://github.com/apache/iceberg-rust/pull/1960#discussion_r2646425513
##########
crates/iceberg/src/spec/snapshot.rs:
##########
@@ -604,6 +615,73 @@ mod tests {
);
}
+ #[test]
+ fn test_v1_snapshot_with_manifest_list_and_manifests() {
+ {
+ let metadata = r#"
+ {
+ "format-version": 1,
+ "table-uuid": "d20125c8-7284-442c-9aea-15fee620737c",
+ "location": "s3://bucket/test/location",
+ "last-updated-ms": 1700000000000,
+ "last-column-id": 1,
+ "schema": {
+ "type": "struct",
+ "fields": [
+ {"id": 1, "name": "x", "required": true, "type": "long"}
+ ]
+ },
+ "partition-spec": [],
+ "properties": {},
+ "current-snapshot-id": 111111111,
+ "snapshots": [
+ {
+ "snapshot-id": 111111111,
+ "timestamp-ms": 1600000000000,
+ "summary": {"operation": "append"},
+ "manifest-list": "s3://bucket/metadata/snap-123.avro",
+ "manifests": ["s3://bucket/metadata/manifest-1.avro"]
+ }
+ ]
+ }
+ "#;
+
+ let result = serde_json::from_str::<TableMetadata>(metadata);
+ assert!(result.is_err());
+ }
+
+ {
+ let metadata = r#"
+ {
+ "format-version": 1,
+ "table-uuid": "d20125c8-7284-442c-9aea-15fee620737c",
+ "location": "s3://bucket/test/location",
+ "last-updated-ms": 1700000000000,
+ "last-column-id": 1,
+ "schema": {
+ "type": "struct",
+ "fields": [
+ {"id": 1, "name": "x", "required": true, "type": "long"}
+ ]
+ },
+ "partition-spec": [],
+ "properties": {},
+ "current-snapshot-id": 111111111,
+ "snapshots": [
+ {
+ "snapshot-id": 111111111,
+ "timestamp-ms": 1600000000000,
+ "summary": {"operation": "append"},
+ "manifests": ["s3://bucket/metadata/manifest-1.avro"]
+ }
+ ]
+ }
+ "#;
+ let result = serde_json::from_str::<TableMetadata>(metadata);
+ assert!(result.is_err());
Review Comment:
In the new commit, I added a check to ensure the error message is correct,
but I’m not sure this is the best approach. Currently, I just convert the error
to a string and compare it.
--
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]