[
https://issues.apache.org/jira/browse/HADOOP-19443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17923554#comment-17923554
]
ASF GitHub Bot commented on HADOOP-19443:
-----------------------------------------
anujmodi2021 commented on code in PR #7344:
URL: https://github.com/apache/hadoop/pull/7344#discussion_r1940450348
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAttributes.java:
##########
@@ -88,9 +91,89 @@ public void testSetGetXAttrReplace() throws Exception {
// however after the xAttr is created, replacing it must succeed
fs.setXAttr(testFile, attributeName, attributeValue1, CREATE_FLAG);
fs.setXAttr(testFile, attributeName, attributeValue2, REPLACE_FLAG);
- Assertions.assertThat(fs.getXAttr(testFile, attributeName))
- .describedAs("Retrieved Attribute Value is Not as Expected")
- .containsExactly(attributeValue2);
+ assertAttributeEqual(fs.getXAttr(testFile, attributeName), attributeValue2,
+ decodedAttribute2);
+ }
+
+ @Test
+ public void testGetSetXAttrOnRoot() throws Exception {
+ AzureBlobFileSystem fs = getFileSystem();
+ String attributeName = "user.attribute1";
+ byte[] attributeValue = fs.getAbfsStore().encodeAttribute("hi");
+ final Path testPath = new Path(ROOT_PATH);
+
+ AbfsRestOperationException ex =
intercept(AbfsRestOperationException.class, () -> {
+ fs.getXAttr(testPath, attributeName);
+ });
+
+ Assertions.assertThat(ex.getStatusCode())
+ .describedAs("GetXAttr() on root should fail with Bad Request")
+ .isEqualTo(HTTP_BAD_REQUEST);
+
+ ex = intercept(AbfsRestOperationException.class, () -> {
+ fs.setXAttr(testPath, attributeName, attributeValue, CREATE_FLAG);
+ });
+
+ Assertions.assertThat(ex.getStatusCode())
+ .describedAs("SetXAttr() on root should fail with Bad Request")
+ .isEqualTo(HTTP_BAD_REQUEST);
+ }
+ @Test
+ public void testGetSetXAttrOnExplicitDir() throws Exception {
+ AzureBlobFileSystem fs = getFileSystem();
+ final Path testPath = path(getMethodName());
+ fs.mkdirs(testPath);
+ testGetSetXAttrHelper(fs, testPath);
+
+ // Assert that the folder is now explicit
+ DirectoryStateHelper.isExplicitDirectory(testPath, fs,
getTestTracingContext(fs, true));
+ }
+ @Test
+ public void testGetSetXAttrOnNonExistingPath() throws Exception {
+ AzureBlobFileSystem fs = getFileSystem();
+ final Path testPath = path(getMethodName());
+ intercept(
+ FileNotFoundException.class, () -> testGetSetXAttrHelper(fs,
testPath));
Review Comment:
Taken
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAttributes.java:
##########
@@ -88,9 +91,89 @@ public void testSetGetXAttrReplace() throws Exception {
// however after the xAttr is created, replacing it must succeed
fs.setXAttr(testFile, attributeName, attributeValue1, CREATE_FLAG);
fs.setXAttr(testFile, attributeName, attributeValue2, REPLACE_FLAG);
- Assertions.assertThat(fs.getXAttr(testFile, attributeName))
- .describedAs("Retrieved Attribute Value is Not as Expected")
- .containsExactly(attributeValue2);
+ assertAttributeEqual(fs.getXAttr(testFile, attributeName), attributeValue2,
+ decodedAttribute2);
+ }
+
+ @Test
+ public void testGetSetXAttrOnRoot() throws Exception {
+ AzureBlobFileSystem fs = getFileSystem();
+ String attributeName = "user.attribute1";
+ byte[] attributeValue = fs.getAbfsStore().encodeAttribute("hi");
+ final Path testPath = new Path(ROOT_PATH);
+
+ AbfsRestOperationException ex =
intercept(AbfsRestOperationException.class, () -> {
+ fs.getXAttr(testPath, attributeName);
+ });
+
+ Assertions.assertThat(ex.getStatusCode())
+ .describedAs("GetXAttr() on root should fail with Bad Request")
+ .isEqualTo(HTTP_BAD_REQUEST);
+
+ ex = intercept(AbfsRestOperationException.class, () -> {
+ fs.setXAttr(testPath, attributeName, attributeValue, CREATE_FLAG);
+ });
+
+ Assertions.assertThat(ex.getStatusCode())
+ .describedAs("SetXAttr() on root should fail with Bad Request")
+ .isEqualTo(HTTP_BAD_REQUEST);
+ }
Review Comment:
Added
##########
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemAttributes.java:
##########
@@ -88,9 +91,89 @@ public void testSetGetXAttrReplace() throws Exception {
// however after the xAttr is created, replacing it must succeed
fs.setXAttr(testFile, attributeName, attributeValue1, CREATE_FLAG);
fs.setXAttr(testFile, attributeName, attributeValue2, REPLACE_FLAG);
- Assertions.assertThat(fs.getXAttr(testFile, attributeName))
- .describedAs("Retrieved Attribute Value is Not as Expected")
- .containsExactly(attributeValue2);
+ assertAttributeEqual(fs.getXAttr(testFile, attributeName), attributeValue2,
+ decodedAttribute2);
+ }
+
Review Comment:
Added
> ABFS: [FnsOverBlob] Update Test Scripts to Run Tests with Blob Endpoint
> -----------------------------------------------------------------------
>
> Key: HADOOP-19443
> URL: https://issues.apache.org/jira/browse/HADOOP-19443
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/azure
> Affects Versions: 3.4.1
> Reporter: Anuj Modi
> Priority: Major
> Labels: pull-request-available
>
> Following Cobination of test Suites will run as a part of CI after blob
> endpoint support has been added.
> HNS-OAuth-DFS
> HNS-SharedKey-DFS
> NonHNS-SharedKey-DFS
> AppendBlob-HNS-OAuth-DFS
> NonHNS-SharedKey-Blob
> NonHNS-OAuth-DFS
> NonHNS-OAuth-Blob
> AppendBlob-NonHNS-OAuth-Blob
> HNS-Oauth-DFS-IngressBlob
> NonHNS-Oauth-DFS-IngressBlob
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]