steveloughran commented on code in PR #7067:
URL: https://github.com/apache/hadoop/pull/7067#discussion_r1773578299
##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java:
##########
@@ -346,6 +347,37 @@ public void
testCentralEndpointAndDifferentRegionThanBucket() throws Throwable {
assertRequesterPaysFileExistence(newConf);
}
+ @Test
+ public void testWithOutCrossRegionAccess() throws Exception {
+ describe("Verify cross region access fails when disabled");
+ final Configuration newConf = new Configuration(getConfiguration());
+ // skip the test if the region is eu-west-2
+ String region =
getFileSystem().getS3AInternals().getBucketMetadata().bucketRegion();
+ if (EU_WEST_2.equals(region)) {
+ return;
+ }
+ // disable cross region access
+ newConf.setBoolean(AWS_S3_CROSS_REGION_ACCESS_ENABLED, false);
+ newConf.set(AWS_REGION, EU_WEST_2);
+ S3AFileSystem fs = new S3AFileSystem();
+ fs.initialize(getFileSystem().getUri(), newConf);
+ intercept(AWSRedirectException.class,
+ "does not match the AWS region containing the bucket",
+ () -> fs.exists(getFileSystem().getWorkingDirectory()));
+ }
+
+ @Test
+ public void testWithCrossRegionAccess() throws Exception {
+ describe("Verify cross region access succeed when enabled");
+ final Configuration newConf = new Configuration(getConfiguration());
+ // enable cross region access
+ newConf.setBoolean(AWS_S3_CROSS_REGION_ACCESS_ENABLED, true);
+ newConf.set(AWS_REGION, EU_WEST_2);
Review Comment:
same comments as above
##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java:
##########
@@ -346,6 +347,37 @@ public void
testCentralEndpointAndDifferentRegionThanBucket() throws Throwable {
assertRequesterPaysFileExistence(newConf);
}
+ @Test
+ public void testWithOutCrossRegionAccess() throws Exception {
+ describe("Verify cross region access fails when disabled");
+ final Configuration newConf = new Configuration(getConfiguration());
+ // skip the test if the region is eu-west-2
+ String region =
getFileSystem().getS3AInternals().getBucketMetadata().bucketRegion();
+ if (EU_WEST_2.equals(region)) {
Review Comment:
1. I'd like a different region here a that is my region and I would like the
test coverage.
2. what happens with third party stores?
##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java:
##########
@@ -346,6 +347,37 @@ public void
testCentralEndpointAndDifferentRegionThanBucket() throws Throwable {
assertRequesterPaysFileExistence(newConf);
}
+ @Test
+ public void testWithOutCrossRegionAccess() throws Exception {
+ describe("Verify cross region access fails when disabled");
+ final Configuration newConf = new Configuration(getConfiguration());
+ // skip the test if the region is eu-west-2
+ String region =
getFileSystem().getS3AInternals().getBucketMetadata().bucketRegion();
+ if (EU_WEST_2.equals(region)) {
+ return;
+ }
+ // disable cross region access
+ newConf.setBoolean(AWS_S3_CROSS_REGION_ACCESS_ENABLED, false);
+ newConf.set(AWS_REGION, EU_WEST_2);
+ S3AFileSystem fs = new S3AFileSystem();
+ fs.initialize(getFileSystem().getUri(), newConf);
+ intercept(AWSRedirectException.class,
+ "does not match the AWS region containing the bucket",
+ () -> fs.exists(getFileSystem().getWorkingDirectory()));
+ }
+
+ @Test
+ public void testWithCrossRegionAccess() throws Exception {
+ describe("Verify cross region access succeed when enabled");
+ final Configuration newConf = new Configuration(getConfiguration());
+ // enable cross region access
+ newConf.setBoolean(AWS_S3_CROSS_REGION_ACCESS_ENABLED, true);
+ newConf.set(AWS_REGION, EU_WEST_2);
+ S3AFileSystem fs = new S3AFileSystem();
Review Comment:
needs to be in try-with-resources to close()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]