Skip to content

Commit

Permalink
HADOOP-18403. Fix FileSystem leak in ITestS3AAWSCredentialsProvider (#…
Browse files Browse the repository at this point in the history
…4737)

Contributed By: Viraj Jasani
  • Loading branch information
virajjasani authored Aug 18, 2022
1 parent b7d4dc6 commit 7f03025
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,15 @@ public void testAnonymousProvider() throws Exception {
conf.set(AWS_CREDENTIALS_PROVIDER,
AnonymousAWSCredentialsProvider.class.getName());
Path testFile = getCSVTestPath(conf);
FileSystem fs = FileSystem.newInstance(testFile.toUri(), conf);
assertNotNull(fs);
assertTrue(fs instanceof S3AFileSystem);
FileStatus stat = fs.getFileStatus(testFile);
assertNotNull(stat);
assertEquals(testFile, stat.getPath());
try (FileSystem fs = FileSystem.newInstance(testFile.toUri(), conf)) {
assertNotNull("S3AFileSystem instance must not be null", fs);
assertTrue("FileSystem must be the instance of S3AFileSystem", fs instanceof S3AFileSystem);
FileStatus stat = fs.getFileStatus(testFile);
assertNotNull("FileStatus with qualified path must not be null", stat);
assertEquals(
"The qualified path returned by getFileStatus should be same as the original file",
testFile, stat.getPath());
}
}

}

0 comments on commit 7f03025

Please sign in to comment.