Skip to content

Commit 12e503e

Browse files
committed
minor test changes
1 parent 44760ca commit 12e503e

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
import software.amazon.awssdk.services.s3.model.HeadBucketResponse;
3939

4040
import org.apache.hadoop.conf.Configuration;
41+
import org.apache.hadoop.fs.FSDataInputStream;
4142
import org.apache.hadoop.fs.FSDataOutputStream;
4243
import org.apache.hadoop.fs.Path;
43-
import org.apache.hadoop.fs.contract.ContractTestUtils;
4444
import org.apache.hadoop.fs.s3a.statistics.impl.EmptyS3AStatisticsContext;
4545
import org.apache.hadoop.fs.s3a.test.PublicDatasetTestUtils;
4646

@@ -282,7 +282,7 @@ public void testWithVPCE() throws Throwable {
282282
}
283283

284284
@Test
285-
public void testCentralEndpointAndDifferentRegion() throws Throwable {
285+
public void testCentralEndpointAndDifferentRegionThanBucket() throws Throwable {
286286
describe("Access public bucket using central endpoint and region "
287287
+ "different than that of the public bucket");
288288
final Configuration conf = getConfiguration();
@@ -318,7 +318,7 @@ public void testCentralEndpointAndDifferentRegion() throws Throwable {
318318
}
319319

320320
@Test
321-
public void testCentralEndpointAndSameRegion() throws Throwable {
321+
public void testCentralEndpointAndSameRegionAsBucket() throws Throwable {
322322
describe("Access public bucket using central endpoint and region "
323323
+ "same as that of the public bucket");
324324
final Configuration conf = getConfiguration();
@@ -354,9 +354,9 @@ public void testCentralEndpointAndSameRegion() throws Throwable {
354354
}
355355

356356
@Test
357-
public void testCentralEndpointWithNullRegion() throws Throwable {
358-
describe("Create bucket on different region and access it using"
359-
+ " central endpoint and null region");
357+
public void testCentralEndpointAndNullRegionWithCRUD() throws Throwable {
358+
describe("Access the test bucket using central endpoint and"
359+
+ " null region, perform file system CRUD operations");
360360
final Configuration conf = getConfiguration();
361361

362362
final Configuration newConf = new Configuration(conf);
@@ -385,8 +385,27 @@ private void assertOpsUsingNewFs() throws IOException {
385385
out.write(new byte[] {1, 2, 3});
386386
}
387387

388-
ContractTestUtils.assertIsFile(getFileSystem(), srcFilePath);
389-
ContractTestUtils.assertIsFile(newFS, srcFilePath);
388+
Assertions
389+
.assertThat(newFS.exists(srcFilePath))
390+
.describedAs("Existence of file: " + srcFilePath)
391+
.isTrue();
392+
Assertions
393+
.assertThat(getFileSystem().exists(srcFilePath))
394+
.describedAs("Existence of file: " + srcFilePath)
395+
.isTrue();
396+
397+
byte[] buffer = new byte[3];
398+
399+
try (FSDataInputStream in = newFS.open(srcFilePath)) {
400+
Assertions
401+
.assertThat(in.read(buffer, 0, 3))
402+
.describedAs("Total bytes read from " + srcFilePath)
403+
.isEqualTo(3);
404+
Assertions
405+
.assertThat(buffer)
406+
.describedAs("Contents read from " + srcFilePath)
407+
.containsExactly(1, 2, 3);
408+
}
390409

391410
newFS.delete(srcDir, true);
392411

0 commit comments

Comments
 (0)