jackye1995 commented on code in PR #5684:
URL: https://github.com/apache/iceberg/pull/5684#discussion_r972501236


##########
aws/src/test/java/org/apache/iceberg/aws/TestAwsProperties.java:
##########
@@ -123,4 +129,74 @@ public void testS3FileIoDeleteBatchSizeTooSmall() {
         "Deletion batch size must be between 1 and 1000",
         () -> new AwsProperties(map));
   }
+
+  @Test
+  public void testS3FileIoCredentialsConfiguration() {
+    Map<String, String> properties = Maps.newHashMap();
+    ArgumentCaptor<AwsCredentialsProvider> 
awsCredentialsProviderArgumentCaptor =
+        ArgumentCaptor.forClass(AwsCredentialsProvider.class);
+
+    // set nothing
+    AwsProperties testAwsPropertiesAllNull = new AwsProperties(properties);
+    S3ClientBuilder mockS3ClientBuilderAllNull = 
Mockito.mock(S3ClientBuilder.class);
+    
testAwsPropertiesAllNull.applyS3CredentialConfigurations(mockS3ClientBuilderAllNull);
+    Mockito.verify(mockS3ClientBuilderAllNull)
+        .credentialsProvider(awsCredentialsProviderArgumentCaptor.capture());
+    AwsCredentialsProvider capturedAwsCredentialsProviderAllNull =
+        awsCredentialsProviderArgumentCaptor.getValue();
+    Assert.assertTrue(
+        "Should use default credentials if nothing is set",
+        capturedAwsCredentialsProviderAllNull instanceof 
DefaultCredentialsProvider);
+
+    // set access key id and secret access key

Review Comment:
   looks like we can separate these to 3 different tests for different behaviors



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