DarkAssassinator commented on code in PR #11762:
URL: https://github.com/apache/dolphinscheduler/pull/11762#discussion_r973571434


##########
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/NetUtilsTest.java:
##########
@@ -99,6 +99,21 @@ public void testIsValidAddress() {
         address = mock(InetAddress.class);
         when(address.getHostAddress()).thenReturn("1.2.3.4");
         assertTrue(NetUtils.isValidV4Address(address));
+        address = mock(InetAddress.class);
+        when(address.getHostAddress()).thenReturn("1.2.3.4:80");
+        assertFalse(NetUtils.isValidV4Address(address));
+        address = mock(InetAddress.class);
+        when(address.getHostAddress()).thenReturn("256.0.0.1");
+        assertFalse(NetUtils.isValidV4Address(address));
+        address = mock(InetAddress.class);
+        when(address.getHostAddress()).thenReturn("127.1");

Review Comment:
   > '127.1' is a validated IpV4 
https://superuser.com/questions/614001/why-can-i-ping-127-1
   
   Hi @ruanwenjun , could we use `InetAddress.isReachable()` to define this IP? 
because Ipv4 has many format



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

Reply via email to