Copilot commented on code in PR #8744:
URL: https://github.com/apache/hadoop/pull/8744#discussion_r4040941342


##########
hadoop-hdfs-project/hadoop-hdfs-nfs/src/test/java/org/apache/hadoop/hdfs/nfs/TestMountd.java:
##########
@@ -70,4 +71,38 @@ public void testStart() throws IOException {
       assertTrue(nfsd.getPortmapUdpTimeoutMillis() == newTimeoutMillis);
     }
   }
+
+  @Test
+  public void testBindHostPropagatedToRpcProgramNfs3() throws IOException {
+    NfsConfiguration config = new NfsConfiguration();
+    config.setInt(NfsConfigKeys.DFS_NFS_SERVER_PORT_KEY, 0);
+    config.setInt(NfsConfigKeys.DFS_NFS_MOUNTD_PORT_KEY, 0);
+    config.set(NfsConfigKeys.DFS_NFS_SERVER_BIND_HOST_KEY, "127.0.0.1");
+    try (MiniDFSCluster cluster = new MiniDFSCluster.Builder(config)
+        .numDataNodes(1).build()) {
+      cluster.waitActive();
+      Nfs3 nfs3 = new Nfs3(config);
+      nfs3.startServiceInternal(false);
+      RpcProgramNfs3 nfsd = (RpcProgramNfs3) nfs3.getRpcProgram();
+      assertEquals("127.0.0.1", nfsd.getBindHost(),
+          "nfs.server.bind.host must be forwarded to RpcProgramNfs3");

Review Comment:
   `startServiceInternal(false)` starts both the mountd and NFS Netty servers, 
but the surrounding try-with-resources only closes the `MiniDFSCluster`. Since 
`register=false` also skips the shutdown hooks, a failed assertion or normal 
test completion leaves the sockets and event-loop threads running; stop `nfs3` 
in a `finally` block (and apply the same cleanup to the mountd test below).



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

Reply via email to