From a325876feca22fa7bf3c90c678d285181b81b30e Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Wed, 13 Mar 2024 05:21:50 -0800 Subject: [PATCH] HADOOP-19066. Run FIPS test for valid bucket locations (ADDENDUM) (#6624) FIPS is only supported in north america AWS regions; relevant tests in ITestS3AEndpointRegion are skipped for buckets with different endpoints/regions. --- .../hadoop/fs/s3a/ITestS3AEndpointRegion.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java index 8fbdcf0b34..8403b6bd6c 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java @@ -51,6 +51,7 @@ import static org.apache.hadoop.fs.s3a.Constants.FIPS_ENDPOINT; import static org.apache.hadoop.fs.s3a.Constants.PATH_STYLE_ACCESS; import static org.apache.hadoop.fs.s3a.DefaultS3ClientFactory.ERROR_ENDPOINT_WITH_FIPS; +import static org.apache.hadoop.fs.s3a.S3ATestUtils.assume; import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides; import static org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils.DEFAULT_REQUESTER_PAYS_BUCKET_NAME; import static org.apache.hadoop.io.IOUtils.closeStream; @@ -76,6 +77,12 @@ public class ITestS3AEndpointRegion extends AbstractS3ATestBase { private static final String US_GOV_EAST_1 = "us-gov-east-1"; + private static final String US_REGION_PREFIX = "us-"; + + private static final String CA_REGION_PREFIX = "ca-"; + + private static final String US_DUAL_STACK_PREFIX = "dualstack.us-"; + /** * If anyone were ever to create a bucket with this UUID pair it would break the tests. */ @@ -435,8 +442,14 @@ public void testCentralEndpointAndNullRegionWithCRUD() throws Throwable { public void testCentralEndpointAndNullRegionFipsWithCRUD() throws Throwable { describe("Access the test bucket using central endpoint and" + " null region and fips enabled, perform file system CRUD operations"); - final Configuration conf = getConfiguration(); + final String bucketLocation = getFileSystem().getBucketLocation(); + assume("FIPS can be enabled to access buckets from US or Canada endpoints only", + bucketLocation.startsWith(US_REGION_PREFIX) + || bucketLocation.startsWith(CA_REGION_PREFIX) + || bucketLocation.startsWith(US_DUAL_STACK_PREFIX)); + + final Configuration conf = getConfiguration(); final Configuration newConf = new Configuration(conf); removeBaseAndBucketOverrides(