[ 
https://issues.apache.org/jira/browse/HADOOP-18869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17760547#comment-17760547
 ] 

ASF GitHub Bot commented on HADOOP-18869:
-----------------------------------------

steveloughran commented on code in PR #6003:
URL: https://github.com/apache/hadoop/pull/6003#discussion_r1310603660


##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemCreate.java:
##########
@@ -146,6 +149,26 @@ public void testCreateNonRecursive2() throws Exception {
     assertIsFile(fs, testFile);
   }
 
+  @Test
+  public void testCreateOnRoot() throws Exception {

Review Comment:
   AbstractContractRootDirectoryTest.testCreateFileOverRoot() shoud be doing 
some of this. 
   1. are those tests running? that's ITestAbfsFileSystemContractRootDirectory
   2. can you add the createNonRecursive test there?



##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAttributes.java:
##########
@@ -110,4 +86,51 @@ public void testSetGetXAttrReplace() throws Exception {
     fs.setXAttr(testFile, attributeName, attributeValue2, REPLACE_FLAG);
     assertArrayEquals(attributeValue2, fs.getXAttr(testFile, attributeName));
   }
+
+  @Test
+  public void testGetSetXAttrOnRoot() throws Exception {
+    AzureBlobFileSystem fs = getFileSystem();
+    final Path testPath = new Path("/");
+    testGetSetXAttrHelper(fs, testPath);
+  }
+
+  private void testGetSetXAttrHelper(final AzureBlobFileSystem fs,
+      final Path testPath) throws Exception {
+
+    String attributeName1 = "user.attribute1";
+    String attributeName2 = "user.attribute2";
+    String decodedAttributeValue1 = "hi";
+    String decodedAttributeValue2 = "hello";
+    byte[] attributeValue1 = 
fs.getAbfsStore().encodeAttribute(decodedAttributeValue1);
+    byte[] attributeValue2 = 
fs.getAbfsStore().encodeAttribute(decodedAttributeValue2);
+
+    // Attribute not present initially
+    assertNull(fs.getXAttr(testPath, attributeName1));
+    assertNull(fs.getXAttr(testPath, attributeName2));
+
+    // Set the Attributes
+    fs.registerListener(
+        new TracingHeaderValidator(fs.getAbfsStore().getAbfsConfiguration()
+            .getClientCorrelationId(),
+            fs.getFileSystemId(), FSOperationType.SET_ATTR, true, 0));
+    fs.setXAttr(testPath, attributeName1, attributeValue1);
+
+    // Check if the attribute is retrievable
+    fs.setListenerOperation(FSOperationType.GET_ATTR);
+    byte[] rv = fs.getXAttr(testPath, attributeName1);
+    assertTrue(Arrays.equals(rv, attributeValue1));

Review Comment:
   AssertJ assertThat() supports array equality, so use it. and add a 
description





> ABFS: Fixing Behavior of a File System APIs on root path
> --------------------------------------------------------
>
>                 Key: HADOOP-18869
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18869
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/azure
>    Affects Versions: 3.3.6
>            Reporter: Anuj Modi
>            Assignee: Anuj Modi
>            Priority: Major
>              Labels: pull-request-available
>
> Following HDFS Apis are failing when called on a root path.
> {*}{*}{*}{*}{*}{*}
> |FS Call|Status|Error thrown to caller|
> |create()|Failing|Operation failed: "The request URI is invalid.", 400, PUT, 
> https://anujtesthns.dfs.core.windows.net/abfs-testcontainer-02076119-21ed-4ada-bcd0-14afaae54013/?resource=file&timeout=90,
>  InvalidUri, "The request URI is invalid. 
> RequestId:1d23f8c2-d01f-0059-61b6-c60c24000000 
> Time:2023-08-04T09:29:55.4813818Z"|
> |createNonRecursive()|Failing|Runtime Exception: 
> java.lang.IllegalArgumentException: null path (This is occuring because 
> getParentPath is null and getFileStatus is called on null)|
> |setXAttr()|Failing|Operation failed: "The request URI is invalid.", 400, 
> HEAD, 
> https://anujtesthns.dfs.core.windows.net/abfs-testcontainer-491399b3-c3d0-4568-9d4a-a26e0aa8f000/?upn=false&timeout=90|
> |getXAttr()|Failing|Operation failed: "The request URI is invalid.", 400, 
> HEAD, 
> https://anujtesthns.dfs.core.windows.net/abfs-testcontainer-491399b3-c3d0-4568-9d4a-a26e0aa8f000/?upn=false&timeout=91|



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to