nastra commented on code in PR #14518:
URL: https://github.com/apache/iceberg/pull/14518#discussion_r2549653312


##########
core/src/test/java/org/apache/iceberg/rest/responses/TestPlanTableScanResponseParser.java:
##########
@@ -440,4 +444,231 @@ public void roundTripSerdeWithoutDeleteFiles() {
 
     
assertThat(PlanTableScanResponseParser.toJson(copyResponse)).isEqualTo(expectedJson);
   }
+
+  @Test
+  public void emptyOrInvalidCredentials() {
+    assertThat(
+            PlanTableScanResponseParser.fromJson(
+                    "{\"plan-status\": \"completed\",\"storage-credentials\": 
null}",
+                    PARTITION_SPECS_BY_ID,
+                    false)
+                .credentials())
+        .isEmpty();
+
+    assertThat(
+            PlanTableScanResponseParser.fromJson(
+                    "{\"plan-status\": \"completed\",\"storage-credentials\": 
[]}",
+                    PARTITION_SPECS_BY_ID,
+                    false)
+                .credentials())
+        .isEmpty();
+
+    assertThatThrownBy(
+            () ->
+                PlanTableScanResponseParser.fromJson(
+                    "{\"plan-status\": \"completed\",\"storage-credentials\": 
\"invalid\"}",
+                    PARTITION_SPECS_BY_ID,
+                    false))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot parse credentials from non-array: \"invalid\"");
+  }
+
+  @Test
+  public void roundTripSerdeWithCredentials() {
+    PlanStatus planStatus = PlanStatus.fromName("completed");
+    List<Credential> credentials =
+        ImmutableList.of(
+            ImmutableCredential.builder()
+                .prefix("s3://custom-uri")
+                .config(
+                    ImmutableMap.of(
+                        "s3.access-key-id",
+                        "keyId",
+                        "s3.secret-access-key",
+                        "accessKey",
+                        "s3.session-token",
+                        "sessionToken"))
+                .build(),
+            ImmutableCredential.builder()
+                .prefix("gs://custom-uri")
+                .config(
+                    ImmutableMap.of(
+                        "gcs.oauth2.token", "gcsToken1", 
"gcs.oauth2.token-expires-at", "1000"))
+                .build(),

Review Comment:
   yes that's possible and the spec allows this explicitly and you'd end up 
with `ResolvingFileIO`



-- 
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]

Reply via email to