steveloughran commented on code in PR #6003:
URL: https://github.com/apache/hadoop/pull/6003#discussion_r1310600768
##########
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 {
+ final AzureBlobFileSystem fs = getFileSystem();
+ Path testFile = path(AbfsHttpConstants.ROOT_PATH);
+ try {
+ fs.create(testFile, true);
Review Comment:
use LambaTestUtils.intercept.
##########
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));
+ assertEquals(decodedAttributeValue1,
fs.getAbfsStore().decodeAttribute(rv));
Review Comment:
add 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]