HADOOP-18368. Fixes ITestCustomSigner for access point names with '-' (#4634)
Contributed By: Ahmar Suhail <ahmarsu@amazon.co.uk>
This commit is contained in:
parent
13fbfd5dea
commit
123d1aa884
|
@ -20,7 +20,6 @@ package org.apache.hadoop.fs.s3a.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -228,10 +227,13 @@ public class ITestCustomSigner extends AbstractS3ATestBase {
|
||||||
if (service.contains("s3-accesspoint") || service.contains("s3-outposts")
|
if (service.contains("s3-accesspoint") || service.contains("s3-outposts")
|
||||||
|| service.contains("s3-object-lambda")) {
|
|| service.contains("s3-object-lambda")) {
|
||||||
// If AccessPoint then bucketName is of format `accessPoint-accountId`;
|
// If AccessPoint then bucketName is of format `accessPoint-accountId`;
|
||||||
String[] accessPointBits = hostBits[0].split("-");
|
String[] accessPointBits = bucketName.split("-");
|
||||||
int lastElem = accessPointBits.length - 1;
|
String accountId = accessPointBits[accessPointBits.length - 1];
|
||||||
String accountId = accessPointBits[lastElem];
|
// Extract the access point name from bucket name. eg: if bucket name is
|
||||||
String accessPointName = String.join("", Arrays.copyOf(accessPointBits, lastElem));
|
// 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()
|
Arn arn = Arn.builder()
|
||||||
.withAccountId(accountId)
|
.withAccountId(accountId)
|
||||||
.withPartition("aws")
|
.withPartition("aws")
|
||||||
|
|
Loading…
Reference in New Issue