steveloughran commented on code in PR #7067:
URL: https://github.com/apache/hadoop/pull/7067#discussion_r1775498471
##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java:
##########
@@ -510,6 +514,16 @@ public void testCentralEndpointAndNullRegionFipsWithCRUD()
throws Throwable {
assertOpsUsingNewFs();
}
+ /**
+ * Skip the test if the region is sa-east-1.
+ */
+ private void skipCrossRegionTest() throws IOException {
+ String region =
getFileSystem().getS3AInternals().getBucketMetadata().bucketRegion();
+ if (SA_EAST_1.equals(region)) {
Review Comment:
needs a story for testing with third party stores. There I have a region
like "unknown" or "test" (but not empty string)
Maybe, rather than be clever here, declare that for testing the region
should be declared as "non-aws", with
* the new string stuck in S3ATestConstants
* the skip test here expanded to check for it
* the testing.md doc updated to cover this
everything else will take any string as a region, at least of those I've
tested
##########
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEndpointRegion.java:
##########
@@ -350,32 +353,33 @@ public void
testCentralEndpointAndDifferentRegionThanBucket() throws Throwable {
@Test
public void testWithOutCrossRegionAccess() throws Exception {
describe("Verify cross region access fails when disabled");
+ // skip the test if the region is sa-east-1
+ skipCrossRegionTest();
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()));
+ newConf.set(AWS_REGION, SA_EAST_1);
+ try (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");
+ // skip the test if the region is sa-east-1
+ skipCrossRegionTest();
final Configuration newConf = new Configuration(getConfiguration());
Review Comment:
call
```
removeBaseAndBucketOverrides(newConf,
AWS_S3_CROSS_REGION_ACCESS_ENABLE,
AWS_REGION)
```
needed to strip out per bucket settings of these options.
--
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]