[ 
https://issues.apache.org/jira/browse/HDFS-16481?focusedWorklogId=734525&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-734525
 ]

ASF GitHub Bot logged work on HDFS-16481:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Mar/22 11:42
            Start Date: 01/Mar/22 11:42
    Worklog Time Spent: 10m 
      Work Description: virajjasani commented on a change in pull request #4028:
URL: https://github.com/apache/hadoop/pull/4028#discussion_r816694773



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/qjournal/TestMiniJournalCluster.java
##########
@@ -52,4 +53,70 @@ public void testStartStop() throws IOException {
       c.shutdown();
     }
   }
+
+  @Test
+  public void testStartStopWithPorts() throws IOException {
+    Configuration conf = new Configuration();
+
+    try {
+      new MiniJournalCluster.Builder(conf).setHttpPorts(8481).build();
+      fail("Should not reach here");
+    } catch (IllegalArgumentException e) {
+      assertEquals("Num of http ports (1) should match num of JournalNodes 
(3)", e.getMessage());
+    }
+
+    try {
+      new MiniJournalCluster.Builder(conf).setRpcPorts(8481, 8482)
+          .build();
+      fail("Should not reach here");
+    } catch (IllegalArgumentException e) {
+      assertEquals("Num of rpc ports (2) should match num of JournalNodes 
(3)", e.getMessage());
+    }
+
+    try {
+      new MiniJournalCluster.Builder(conf).setHttpPorts(800, 9000, 
10000).setRpcPorts(8481)
+          .build();
+      fail("Should not reach here");
+    } catch (IllegalArgumentException e) {
+      assertEquals("Num of rpc ports (1) should match num of JournalNodes 
(3)", e.getMessage());
+    }
+
+    try {
+      new MiniJournalCluster.Builder(conf).setHttpPorts(800, 9000, 1000, 2000)
+          .setRpcPorts(8481, 8482, 8483)
+          .build();
+      fail("Should not reach here");
+    } catch (IllegalArgumentException e) {
+      assertEquals("Num of http ports (4) should match num of JournalNodes 
(3)", e.getMessage());
+    }
+
+    MiniJournalCluster miniJournalCluster =
+        new MiniJournalCluster.Builder(conf).setHttpPorts(8481, 8482, 8483)
+            .setRpcPorts(8491, 8492, 8493).build();

Review comment:
       Thanks. @ayushtkn I just wanted to see if this UT with hardcoded ports 
pass in Jenkins build and since it did, is it good enough for us to keep? If 
not, it's fine and I can try to randomize the ports generation (similar to 
default case) and assert that randomly chosen port is the one being used by 
MiniJournal cluster.




-- 
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: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 734525)
    Time Spent: 1h 50m  (was: 1h 40m)

> Provide support to set Http and Rpc ports in MiniJournalCluster
> ---------------------------------------------------------------
>
>                 Key: HDFS-16481
>                 URL: https://issues.apache.org/jira/browse/HDFS-16481
>             Project: Hadoop HDFS
>          Issue Type: Task
>            Reporter: Viraj Jasani
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> We should provide support for clients to set Http and Rpc ports of 
> JournalNodes in MiniJournalCluster.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to