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

stevel 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 f5464831a08 HADOOP-18696. ITestS3ABucketExistence arn test failures. 
(#5557)
f5464831a08 is described below

commit f5464831a0890b7d9b5eb59bce566c5cebb908ec
Author: Steve Loughran <ste...@cloudera.com>
AuthorDate: Mon Apr 17 10:18:33 2023 +0100

    HADOOP-18696. ITestS3ABucketExistence arn test failures. (#5557)
    
    Explicitly sets the fs.s3a.endpoint.region to eu-west-1 so
    the ARN-referenced fs creation fails with unknown store
    rather than IllegalArgumentException.
    
    Steve Loughran
---
 .../apache/hadoop/fs/s3a/ITestS3ABucketExistence.java  | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABucketExistence.java
 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABucketExistence.java
index fb295f3f09f..9485202f64c 100644
--- 
a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABucketExistence.java
+++ 
b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ABucketExistence.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.test.LambdaTestUtils;
 
 import static org.apache.hadoop.fs.contract.ContractTestUtils.dataset;
 import static org.apache.hadoop.fs.contract.ContractTestUtils.writeDataset;
+import static org.apache.hadoop.fs.s3a.Constants.AWS_REGION;
 import static org.apache.hadoop.fs.s3a.Constants.AWS_S3_ACCESSPOINT_REQUIRED;
 import static org.apache.hadoop.fs.s3a.Constants.FS_S3A;
 import static org.apache.hadoop.fs.s3a.Constants.S3A_BUCKET_PROBE;
@@ -47,7 +48,7 @@ public class ITestS3ABucketExistence extends 
AbstractS3ATestBase {
   private FileSystem fs;
 
   private final String randomBucket =
-          "random-bucket-" + UUID.randomUUID().toString();
+          "random-bucket-" + UUID.randomUUID();
 
   private final URI uri = URI.create(FS_S3A + "://" + randomBucket + "/");
 
@@ -163,7 +164,7 @@ public class ITestS3ABucketExistence extends 
AbstractS3ATestBase {
   @Test
   public void testAccessPointProbingV2() throws Exception {
     describe("Test V2 bucket probing using an AccessPoint ARN");
-    Configuration configuration = createConfigurationWithProbe(2);
+    Configuration configuration = createArnConfiguration();
     String accessPointArn = "arn:aws:s3:eu-west-1:123456789012:accesspoint/" + 
randomBucket;
     configuration.set(String.format(InternalConstants.ARN_BUCKET_OPTION, 
randomBucket),
         accessPointArn);
@@ -175,7 +176,7 @@ public class ITestS3ABucketExistence extends 
AbstractS3ATestBase {
   @Test
   public void testAccessPointRequired() throws Exception {
     describe("Test V2 bucket probing with 'fs.s3a.accesspoint.required' 
property.");
-    Configuration configuration = createConfigurationWithProbe(2);
+    Configuration configuration = createArnConfiguration();
     configuration.set(AWS_S3_ACCESSPOINT_REQUIRED, "true");
     intercept(PathIOException.class,
         InternalConstants.AP_REQUIRED_EXCEPTION,
@@ -189,6 +190,17 @@ public class ITestS3ABucketExistence extends 
AbstractS3ATestBase {
         () -> FileSystem.get(uri, configuration));
   }
 
+  /**
+   * Create a configuration which has bucket probe 2 and the endpoint.region
+   * option set to "eu-west-1" to match that of the ARNs generated.
+   * @return a configuration for tests which are expected to fail in specific 
ways.
+   */
+  private Configuration createArnConfiguration() {
+    Configuration configuration = createConfigurationWithProbe(2);
+    configuration.set(AWS_REGION, "eu-west-1");
+    return configuration;
+  }
+
   @Override
   protected Configuration getConfiguration() {
     Configuration configuration = super.getConfiguration();


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