hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [1/4] hadoop git commit: HADOOP-13389 TestS3ATemporaryCredentials.testSTS error when using IAM credentials. Contributed by Steven K. Wong
Date Sat, 23 Jul 2016 17:01:21 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 e6ba69b4d -> bdde7edba
  refs/heads/branch-2.8 0456069ac -> 7c46303de
  refs/heads/branch-3.0.0-alpha1 05b6d12f1 -> 91439c6f9
  refs/heads/trunk b79ba4fe9 -> 7052ca880


HADOOP-13389 TestS3ATemporaryCredentials.testSTS error when using IAM credentials. Contributed
by Steven K. Wong


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7c46303d
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7c46303d
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7c46303d

Branch: refs/heads/branch-2.8
Commit: 7c46303de3d0d5f9375df0d426121a3885069620
Parents: 0456069
Author: Steve Loughran <stevel@apache.org>
Authored: Sat Jul 23 17:58:46 2016 +0100
Committer: Steve Loughran <stevel@apache.org>
Committed: Sat Jul 23 17:58:46 2016 +0100

----------------------------------------------------------------------
 .../fs/s3a/TestS3ATemporaryCredentials.java     | 24 +++++++++-----------
 1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/7c46303d/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ATemporaryCredentials.java
----------------------------------------------------------------------
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ATemporaryCredentials.java
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ATemporaryCredentials.java
index be5c599..2d45bcc 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ATemporaryCredentials.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3ATemporaryCredentials.java
@@ -19,10 +19,10 @@
 package org.apache.hadoop.fs.s3a;
 
 import java.io.IOException;
+import java.net.URI;
 
 import com.amazonaws.auth.AWSCredentials;
-import com.amazonaws.auth.AWSCredentialsProviderChain;
-import com.amazonaws.auth.InstanceProfileCredentialsProvider;
+import com.amazonaws.auth.AWSCredentialsProvider;
 import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient;
 import com.amazonaws.services.securitytoken.model.GetSessionTokenRequest;
 import com.amazonaws.services.securitytoken.model.GetSessionTokenResult;
@@ -31,6 +31,7 @@ import com.amazonaws.services.securitytoken.model.Credentials;
 import org.apache.hadoop.fs.contract.AbstractFSContract;
 import org.apache.hadoop.fs.contract.AbstractFSContractTestBase;
 import org.apache.hadoop.fs.contract.s3a.S3AContract;
+import org.apache.hadoop.fs.s3native.S3xLoginHelper;
 import org.apache.hadoop.conf.Configuration;
 
 import org.junit.Test;
@@ -54,9 +55,6 @@ public class TestS3ATemporaryCredentials extends AbstractFSContractTestBase
{
   private static final Logger LOG =
       LoggerFactory.getLogger(TestS3ATemporaryCredentials.class);
 
-  private S3AFileSystem fs;
-
-
   private static final String PROVIDER_CLASS =
       "org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider";
 
@@ -84,15 +82,15 @@ public class TestS3ATemporaryCredentials extends AbstractFSContractTestBase
{
       skip("STS functional tests disabled");
     }
 
-    String parentAccessKey = conf.getTrimmed(ACCESS_KEY, null);
-    String parentSecretKey = conf.getTrimmed(SECRET_KEY, null);
-    String stsEndpoint = conf.getTrimmed(TEST_STS_ENDPOINT, "");
-    AWSCredentialsProviderChain parentCredentials;
-    parentCredentials = new AWSCredentialsProviderChain(
-      new BasicAWSCredentialsProvider(parentAccessKey, parentSecretKey),
-      new InstanceProfileCredentialsProvider()
-    );
+    S3xLoginHelper.Login login = S3AUtils.getAWSAccessKeys(
+        URI.create("s3a://foobar"), conf);
+    if (!login.hasLogin()) {
+      skip("testSTS disabled because AWS credentials not configured");
+    }
+    AWSCredentialsProvider parentCredentials = new BasicAWSCredentialsProvider(
+        login.getUser(), login.getPassword());
 
+    String stsEndpoint = conf.getTrimmed(TEST_STS_ENDPOINT, "");
     AWSSecurityTokenServiceClient stsClient;
     stsClient = new AWSSecurityTokenServiceClient(parentCredentials);
     if (!stsEndpoint.isEmpty()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message