corleyma commented on a change in pull request #7803:
URL: https://github.com/apache/arrow/pull/7803#discussion_r468174939



##########
File path: cpp/src/arrow/filesystem/s3fs_test.cc
##########
@@ -197,6 +197,32 @@ TEST(S3Options, FromUri) {
   ASSERT_RAISES(Invalid, S3Options::FromUri("s3:///foo/bar/", &path));
 }
 
+TEST(S3Options, FromAccessKey) {
+  S3Options options;
+
+  // session token is optional and should default to empty string
+  options = S3Options::FromAccessKey("access", "secret");
+  ASSERT_EQ(options.GetAccessKey(), "access");
+  ASSERT_EQ(options.GetSecretKey(), "secret");
+  ASSERT_EQ(options.GetSessionToken(), "");
+
+  options = S3Options::FromAccessKey("access", "secret", "token");
+  ASSERT_EQ(options.GetAccessKey(), "access");
+  ASSERT_EQ(options.GetSecretKey(), "secret");
+  ASSERT_EQ(options.GetSessionToken(), "token");
+}
+
+TEST(S3Options, FromAssumeRole) {
+  S3Options options;
+
+  // the only required argument should be role arn
+  options = S3Options::FromAssumeRole("my_role_arn");

Review comment:
       I added 2 relevant changes:
   - I updated the test to set an env var that will cause 
DefaultAWSCredentialsProviderChain to skip trying the EC2 instance metadata 
endpoint
   - I added the ability to provide your own STSClient instead of using the 
default configuration, so users can choose to use something other than e.g. the 
DefaultAWSCredentialsProviderChain.
   The test runtime is down from ~5s to ~3ms.

##########
File path: cpp/src/arrow/filesystem/s3fs_test.cc
##########
@@ -197,6 +197,32 @@ TEST(S3Options, FromUri) {
   ASSERT_RAISES(Invalid, S3Options::FromUri("s3:///foo/bar/", &path));
 }
 
+TEST(S3Options, FromAccessKey) {
+  S3Options options;
+
+  // session token is optional and should default to empty string
+  options = S3Options::FromAccessKey("access", "secret");
+  ASSERT_EQ(options.GetAccessKey(), "access");
+  ASSERT_EQ(options.GetSecretKey(), "secret");
+  ASSERT_EQ(options.GetSessionToken(), "");
+
+  options = S3Options::FromAccessKey("access", "secret", "token");
+  ASSERT_EQ(options.GetAccessKey(), "access");
+  ASSERT_EQ(options.GetSecretKey(), "secret");
+  ASSERT_EQ(options.GetSessionToken(), "token");
+}
+
+TEST(S3Options, FromAssumeRole) {
+  S3Options options;
+
+  // the only required argument should be role arn
+  options = S3Options::FromAssumeRole("my_role_arn");

Review comment:
       I added 2 relevant changes:
   - I updated the test to set an env var that will cause 
DefaultAWSCredentialsProviderChain to skip trying the EC2 instance metadata 
endpoint
   - I added the ability to provide your own STSClient instead of using the 
default configuration, so users can choose to use something other than e.g. the 
DefaultAWSCredentialsProviderChain.
   
   The test runtime is down from ~5s to ~3ms.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to