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.
This commit is contained in:
Viraj Jasani 2024-03-13 05:21:50 -08:00 committed by GitHub
parent e28c78f9a2
commit a325876fec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,6 +51,7 @@
import static org.apache.hadoop.fs.s3a.Constants.FIPS_ENDPOINT; 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.Constants.PATH_STYLE_ACCESS;
import static org.apache.hadoop.fs.s3a.DefaultS3ClientFactory.ERROR_ENDPOINT_WITH_FIPS; 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.S3ATestUtils.removeBaseAndBucketOverrides;
import static org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils.DEFAULT_REQUESTER_PAYS_BUCKET_NAME; import static org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils.DEFAULT_REQUESTER_PAYS_BUCKET_NAME;
import static org.apache.hadoop.io.IOUtils.closeStream; 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_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. * 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 { public void testCentralEndpointAndNullRegionFipsWithCRUD() throws Throwable {
describe("Access the test bucket using central endpoint and" describe("Access the test bucket using central endpoint and"
+ " null region and fips enabled, perform file system CRUD operations"); + " 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); final Configuration newConf = new Configuration(conf);
removeBaseAndBucketOverrides( removeBaseAndBucketOverrides(