Skip to content

Commit a325876

Browse files
authored
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.
1 parent e28c78f commit a325876

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import static org.apache.hadoop.fs.s3a.Constants.FIPS_ENDPOINT;
5252
import static org.apache.hadoop.fs.s3a.Constants.PATH_STYLE_ACCESS;
5353
import static org.apache.hadoop.fs.s3a.DefaultS3ClientFactory.ERROR_ENDPOINT_WITH_FIPS;
54+
import static org.apache.hadoop.fs.s3a.S3ATestUtils.assume;
5455
import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides;
5556
import static org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils.DEFAULT_REQUESTER_PAYS_BUCKET_NAME;
5657
import static org.apache.hadoop.io.IOUtils.closeStream;
@@ -76,6 +77,12 @@ public class ITestS3AEndpointRegion extends AbstractS3ATestBase {
7677

7778
private static final String US_GOV_EAST_1 = "us-gov-east-1";
7879

80+
private static final String US_REGION_PREFIX = "us-";
81+
82+
private static final String CA_REGION_PREFIX = "ca-";
83+
84+
private static final String US_DUAL_STACK_PREFIX = "dualstack.us-";
85+
7986
/**
8087
* If anyone were ever to create a bucket with this UUID pair it would break the tests.
8188
*/
@@ -435,8 +442,14 @@ public void testCentralEndpointAndNullRegionWithCRUD() throws Throwable {
435442
public void testCentralEndpointAndNullRegionFipsWithCRUD() throws Throwable {
436443
describe("Access the test bucket using central endpoint and"
437444
+ " null region and fips enabled, perform file system CRUD operations");
438-
final Configuration conf = getConfiguration();
439445

446+
final String bucketLocation = getFileSystem().getBucketLocation();
447+
assume("FIPS can be enabled to access buckets from US or Canada endpoints only",
448+
bucketLocation.startsWith(US_REGION_PREFIX)
449+
|| bucketLocation.startsWith(CA_REGION_PREFIX)
450+
|| bucketLocation.startsWith(US_DUAL_STACK_PREFIX));
451+
452+
final Configuration conf = getConfiguration();
440453
final Configuration newConf = new Configuration(conf);
441454

442455
removeBaseAndBucketOverrides(

0 commit comments

Comments
 (0)