This is an automated email from the ASF dual-hosted git repository.

mthakur pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
     new 4e842a7ff32 HADOOP-18368. Fixes ITestCustomSigner for access point 
names with '-' (#4634)
4e842a7ff32 is described below

commit 4e842a7ff32327d503cfb6c6c9151e623dc8ce37
Author: ahmarsuhail <ahmar.suh...@gmail.com>
AuthorDate: Mon Aug 1 21:19:42 2022 +0100

    HADOOP-18368. Fixes ITestCustomSigner for access point names with '-' 
(#4634)
    
    
     Contributed By: Ahmar Suhail <ahma...@amazon.co.uk>
---
 .../org/apache/hadoop/fs/s3a/auth/ITestCustomSigner.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ITestCustomSigner.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ITestCustomSigner.java
index cbba326d5ec..a829d470e7a 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ITestCustomSigner.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth/ITestCustomSigner.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.fs.s3a.auth;
 
 import java.io.IOException;
 import java.security.PrivilegedExceptionAction;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
@@ -228,10 +227,13 @@ public class ITestCustomSigner extends 
AbstractS3ATestBase {
       if (service.contains("s3-accesspoint") || service.contains("s3-outposts")
           || service.contains("s3-object-lambda")) {
         // If AccessPoint then bucketName is of format `accessPoint-accountId`;
-        String[] accessPointBits = hostBits[0].split("-");
-        int lastElem = accessPointBits.length - 1;
-        String accountId = accessPointBits[lastElem];
-        String accessPointName = String.join("", 
Arrays.copyOf(accessPointBits, lastElem));
+        String[] accessPointBits = bucketName.split("-");
+        String accountId = accessPointBits[accessPointBits.length - 1];
+        // Extract the access point name from bucket name. eg: if bucket name 
is
+        // test-custom-signer-<accountId>, get the access point name 
test-custom-signer by removing
+        // -<accountId> from the bucket name.
+        String accessPointName =
+            bucketName.substring(0, bucketName.length() - (accountId.length() 
+ 1));
         Arn arn = Arn.builder()
             .withAccountId(accountId)
             .withPartition("aws")


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

Reply via email to