[ 
https://issues.apache.org/jira/browse/HADOOP-17765?focusedWorklogId=625096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-625096
 ]

ASF GitHub Bot logged work on HADOOP-17765:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Jul/21 10:05
            Start Date: 20/Jul/21 10:05
    Worklog Time Spent: 10m 
      Work Description: 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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 625096)
    Time Spent: 5h  (was: 4h 50m)

> ABFS: Use Unique File Paths in Tests
> ------------------------------------
>
>                 Key: HADOOP-17765
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17765
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.3.1
>            Reporter: Sumangala Patki
>            Assignee: Sumangala Patki
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5h
>  Remaining Estimate: 0h
>
> Many of ABFS driver tests use common names for file paths (e.g., 
> "/testfile"). This poses a risk of errors during parallel test runs when 
> static variables (such as those for monitoring stats) affected by file paths 
> are introduced.
> Using unique test file names will avoid possible errors arising from shared 
> resources during parallel runs.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to