steveloughran commented on a change in pull request #3153:
URL: https://github.com/apache/hadoop/pull/3153#discussion_r672590069
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/ITestAbfsOutputStream.java
##########
@@ -71,7 +70,7 @@ public void testMaxRequestsAndQueueCapacity() throws
Exception {
conf.set(ConfigurationKeys.AZURE_WRITE_MAX_REQUESTS_TO_QUEUE,
"" + maxRequestsToQueue);
final AzureBlobFileSystem fs = getFileSystem(conf);
- FSDataOutputStream out = fs.create(TEST_FILE_PATH);
+ FSDataOutputStream out = fs.create(path(TEST_FILE_PATH));
Review comment:
this should be closed too in try-with-resources or try/finally
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemOauth.java
##########
@@ -161,14 +167,14 @@ public void testBlobDataReader() throws Exception {
}
- private void prepareFiles() throws IOException {
+ private void prepareFiles(Path existedFilePath, Path existedFolderPath)
throws IOException {
// create test files/folders to verify access control diff between
// Blob data contributor and Blob data reader
final AzureBlobFileSystem fs = this.getFileSystem();
- fs.create(EXISTED_FILE_PATH);
- assertTrue(fs.exists(EXISTED_FILE_PATH));
- fs.mkdirs(EXISTED_FOLDER_PATH);
- assertTrue(fs.exists(EXISTED_FOLDER_PATH));
+ fs.create(existedFilePath);
Review comment:
should be `fs.create(existedFilePath).close()`. Not your change, but as
the line is changed, time to fix
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemOauth.java
##########
@@ -134,25 +140,25 @@ public void testBlobDataReader() throws Exception {
// TEST READ FS
Map<String, String> properties =
abfsStore.getFilesystemProperties(tracingContext);
// TEST READ FOLDER
- assertTrue(fs.exists(EXISTED_FOLDER_PATH));
+ assertPathExists(fs, "This path should exist", existedFolderPath);
// TEST DELETE FOLDER
try {
- abfsStore.delete(EXISTED_FOLDER_PATH, true, tracingContext);
+ abfsStore.delete(existedFolderPath, true, tracingContext);
} catch (AbfsRestOperationException e) {
assertEquals(AzureServiceErrorCode.AUTHORIZATION_PERMISSION_MISS_MATCH,
e.getErrorCode());
}
// TEST READ FILE
- try (InputStream inputStream =
abfsStore.openFileForRead(EXISTED_FILE_PATH, null,
- tracingContext)) {
+ try (InputStream inputStream = abfsStore
+ .openFileForRead(existedFilePath, null, tracingContext)) {
assertTrue(inputStream.read() != 0);
}
// TEST WRITE FILE
try {
- abfsStore.openFileForWrite(EXISTED_FILE_PATH, fs.getFsStatistics(), true,
- tracingContext);
+ abfsStore.openFileForWrite(existedFilePath, fs.getFsStatistics(), true,
Review comment:
Looking at this line (and it predates your patch): does the output
stream need to be closed?
##########
File path:
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStatistics.java
##########
@@ -213,12 +213,12 @@ public void testOpenAppendRenameExists() throws
IOException {
assertAbfsStatistics(AbfsStatistic.CALL_RENAME, 1, metricMap);
//Testing if file exists at path.
- assertPathExists(fs,
- String.format("File with name %s should exist", destCreateFilePath),
- destCreateFilePath);
- assertPathDoesNotExist(fs,
- String.format("File with name %s should not exist", createFilePath),
- createFilePath);
+ assertTrue(String.format("File with name %s should exist",
Review comment:
why switch from AssertPathExists?
If you want to go to the simpler true/false, move to AssertJ whose assert
strings "describedAs()" as string formats only evaluated to assert failue.
--
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]