3434
3535import static org .apache .hadoop .fs .contract .ContractTestUtils .dataset ;
3636import static org .apache .hadoop .fs .contract .ContractTestUtils .writeDataset ;
37+ import static org .apache .hadoop .fs .s3a .Constants .AWS_REGION ;
3738import static org .apache .hadoop .fs .s3a .Constants .AWS_S3_ACCESSPOINT_REQUIRED ;
3839import static org .apache .hadoop .fs .s3a .Constants .FS_S3A ;
3940import static org .apache .hadoop .fs .s3a .Constants .S3A_BUCKET_PROBE ;
@@ -47,7 +48,7 @@ public class ITestS3ABucketExistence extends AbstractS3ATestBase {
4748 private FileSystem fs ;
4849
4950 private final String randomBucket =
50- "random-bucket-" + UUID .randomUUID (). toString () ;
51+ "random-bucket-" + UUID .randomUUID ();
5152
5253 private final URI uri = URI .create (FS_S3A + "://" + randomBucket + "/" );
5354
@@ -163,7 +164,7 @@ public void testBucketProbingParameterValidation() throws Exception {
163164 @ Test
164165 public void testAccessPointProbingV2 () throws Exception {
165166 describe ("Test V2 bucket probing using an AccessPoint ARN" );
166- Configuration configuration = createConfigurationWithProbe ( 2 );
167+ Configuration configuration = createArnConfiguration ( );
167168 String accessPointArn = "arn:aws:s3:eu-west-1:123456789012:accesspoint/" + randomBucket ;
168169 configuration .set (String .format (InternalConstants .ARN_BUCKET_OPTION , randomBucket ),
169170 accessPointArn );
@@ -175,7 +176,7 @@ public void testAccessPointProbingV2() throws Exception {
175176 @ Test
176177 public void testAccessPointRequired () throws Exception {
177178 describe ("Test V2 bucket probing with 'fs.s3a.accesspoint.required' property." );
178- Configuration configuration = createConfigurationWithProbe ( 2 );
179+ Configuration configuration = createArnConfiguration ( );
179180 configuration .set (AWS_S3_ACCESSPOINT_REQUIRED , "true" );
180181 intercept (PathIOException .class ,
181182 InternalConstants .AP_REQUIRED_EXCEPTION ,
@@ -189,6 +190,17 @@ public void testAccessPointRequired() throws Exception {
189190 () -> FileSystem .get (uri , configuration ));
190191 }
191192
193+ /**
194+ * Create a configuration which has bucket probe 2 and the endpoint.region
195+ * option set to "eu-west-1" to match that of the ARNs generated.
196+ * @return a configuration for tests which are expected to fail in specific ways.
197+ */
198+ private Configuration createArnConfiguration () {
199+ Configuration configuration = createConfigurationWithProbe (2 );
200+ configuration .set (AWS_REGION , "eu-west-1" );
201+ return configuration ;
202+ }
203+
192204 @ Override
193205 protected Configuration getConfiguration () {
194206 Configuration configuration = super .getConfiguration ();
0 commit comments