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
--
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]