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

ASF GitHub Bot commented on HDFS-17029:
---------------------------------------

zhtttylz commented on code in PR #5698:
URL: https://github.com/apache/hadoop/pull/5698#discussion_r1213978842


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java:
##########
@@ -2291,6 +2291,36 @@ public void testFsStatus() throws Exception {
     }
   }
 
+  @Test
+  public void testGetErasureCodingPolicies() throws Exception {
+    final Configuration conf = WebHdfsTestUtil.createConf();
+    try {
+      cluster = new MiniDFSCluster.Builder(conf).build();
+      cluster.waitActive();
+
+      final WebHdfsFileSystem webHdfs =
+          WebHdfsTestUtil.getWebHdfsFileSystem(conf,
+              WebHdfsConstants.WEBHDFS_SCHEME);
+
+      final DistributedFileSystem dfs = cluster.getFileSystem();
+
+      Collection<ErasureCodingPolicyInfo> webHdfsEcPolicyInfos =
+          webHdfs.getAllErasureCodingPolicies();
+
+      Collection<ErasureCodingPolicyInfo> dfsEcPolicyInfos =
+          dfs.getAllErasureCodingPolicies();
+
+      //Validate erasureCodingPolicyInfos are the same as DistributedFileSystem
+      boolean isEqual = webHdfsEcPolicyInfos.stream()
+          .allMatch(dfsEcPolicyInfos::contains) &&
+          dfsEcPolicyInfos.stream()
+              .allMatch(webHdfsEcPolicyInfos::contains);
+      assertTrue(isEqual);

Review Comment:
   Thank you for your valuable suggestion. I greatly appreciate it and will 
promptly make the necessary changes to the code!





> Support getECPolices API in WebHDFS
> -----------------------------------
>
>                 Key: HDFS-17029
>                 URL: https://issues.apache.org/jira/browse/HDFS-17029
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: webhdfs
>    Affects Versions: 3.4.0
>            Reporter: Hualong Zhang
>            Assignee: Hualong Zhang
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2023-05-29-23-55-09-224.png
>
>
> WebHDFS should support getEcPolicies:
> !image-2023-05-29-23-55-09-224.png|width=817,height=234!



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