[ https://issues.apache.org/jira/browse/HADOOP-18980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17811153#comment-17811153 ]
ASF GitHub Bot commented on HADOOP-18980: ----------------------------------------- virajjasani commented on code in PR #6406: URL: https://github.com/apache/hadoop/pull/6406#discussion_r1467312975 ########## hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java: ########## @@ -206,6 +210,52 @@ public void testFallbackToDefaults() throws Throwable { assertTrue("empty credentials", credentials.size() > 0); } + @Test + public void testAssumedRoleWithRemap() throws Throwable { + Configuration conf = new Configuration(false); + conf.set(ASSUMED_ROLE_CREDENTIALS_PROVIDER, + "custom.assume.role.key1,custom.assume.role.key2,custom.assume.role.key3"); + conf.set(AWS_CREDENTIALS_PROVIDER_MAPPING, + "custom.assume.role.key1=" + + CredentialProviderListFactory.ENVIRONMENT_CREDENTIALS_V2 + + " ,custom.assume.role.key2 =" + + CountInvocationsProvider.NAME + + ", custom.assume.role.key3= " + + CredentialProviderListFactory.PROFILE_CREDENTIALS_V1); + final AWSCredentialProviderList credentials = + buildAWSProviderList( + new URI("s3a://bucket1"), + conf, + ASSUMED_ROLE_CREDENTIALS_PROVIDER, + new ArrayList<>(), + new HashSet<>()); + assertEquals("Credentials not matching", 3, credentials.size()); + } + + @Test + public void testAwsCredentialProvidersWithRemap() throws Throwable { + Configuration conf = new Configuration(false); + conf.set(AWS_CREDENTIALS_PROVIDER, + "custom.aws.creds.key1,custom.aws.creds.key2,custom.aws.creds.key3,custom.aws.creds.key4"); + conf.set(AWS_CREDENTIALS_PROVIDER_MAPPING, + "custom.aws.creds.key1=" + + CredentialProviderListFactory.ENVIRONMENT_CREDENTIALS_V2 + + " ,\ncustom.aws.creds.key2=" + + CountInvocationsProvider.NAME + + "\n, custom.aws.creds.key3=" + + CredentialProviderListFactory.PROFILE_CREDENTIALS_V1 + + ",custom.aws.creds.key4 = " + + CredentialProviderListFactory.PROFILE_CREDENTIALS_V2); + final AWSCredentialProviderList credentials = + buildAWSProviderList( + new URI("s3a://bucket1"), + conf, + AWS_CREDENTIALS_PROVIDER, + new ArrayList<>(), + new HashSet<>()); + assertEquals("Credentials not matching", 4, credentials.size()); Review Comment: It's really good one, API rich, gives nice error msg. I really wish to start using it for all other projects too. Some don't even use "error msg string for AssertionError" for assertEquals etc, making flaky tests debugging annoying at times. > S3A credential provider remapping: make extensible > -------------------------------------------------- > > Key: HADOOP-18980 > URL: https://issues.apache.org/jira/browse/HADOOP-18980 > Project: Hadoop Common > Issue Type: Sub-task > Components: fs/s3 > Affects Versions: 3.4.0 > Reporter: Steve Loughran > Assignee: Viraj Jasani > Priority: Minor > Labels: pull-request-available > > s3afs will now remap the common com.amazonaws credential providers to > equivalents in the v2 sdk or in hadoop-aws > We could do the same for third party credential providers by taking a > key=value list in a configuration property and adding to the map. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org