HADOOP-18403. Fix FileSystem leak in ITestS3AAWSCredentialsProvider (#4737)
Contributed By: Viraj Jasani
This commit is contained in:
parent
a5d5d0708a
commit
51ddd02395
|
@ -162,12 +162,15 @@ public class ITestS3AAWSCredentialsProvider {
|
||||||
conf.set(AWS_CREDENTIALS_PROVIDER,
|
conf.set(AWS_CREDENTIALS_PROVIDER,
|
||||||
AnonymousAWSCredentialsProvider.class.getName());
|
AnonymousAWSCredentialsProvider.class.getName());
|
||||||
Path testFile = getCSVTestPath(conf);
|
Path testFile = getCSVTestPath(conf);
|
||||||
FileSystem fs = FileSystem.newInstance(testFile.toUri(), conf);
|
try (FileSystem fs = FileSystem.newInstance(testFile.toUri(), conf)) {
|
||||||
assertNotNull(fs);
|
assertNotNull("S3AFileSystem instance must not be null", fs);
|
||||||
assertTrue(fs instanceof S3AFileSystem);
|
assertTrue("FileSystem must be the instance of S3AFileSystem", fs instanceof S3AFileSystem);
|
||||||
FileStatus stat = fs.getFileStatus(testFile);
|
FileStatus stat = fs.getFileStatus(testFile);
|
||||||
assertNotNull(stat);
|
assertNotNull("FileStatus with qualified path must not be null", stat);
|
||||||
assertEquals(testFile, stat.getPath());
|
assertEquals(
|
||||||
|
"The qualified path returned by getFileStatus should be same as the original file",
|
||||||
|
testFile, stat.getPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue