You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/21 06:45:34 UTC

[GitHub] [pulsar] eolivelli commented on a diff in pull request #16152: [fix][client]Fix auto cluster failover can't resolve host bug

eolivelli commented on code in PR #16152:
URL: https://github.com/apache/pulsar/pull/16152#discussion_r902218791


##########
pulsar-client/src/test/java/org/apache/pulsar/client/impl/AutoClusterFailoverTest.java:
##########
@@ -283,4 +291,46 @@ public void testAutoClusterFailoverSwitchTlsTrustStore() throws IOException {
                 .updateTlsTrustStorePathAndPassword(primaryTlsTrustStorePath, primaryTlsTrustStorePassword);
 
     }
+
+    @Test
+    public void testUrl() throws Exception {
+        Random random = new Random(42);
+        String serviceUrl = "pulsar://localhost:" + random.nextInt(65535);
+
+
+        PulsarServiceNameResolver resolver = new PulsarServiceNameResolver();
+
+        try {
+            resolver.updateServiceUrl(serviceUrl);
+            InetSocketAddress inetSocketAddress = new InetSocketAddress(resolver.resolveHost().getHostName(), resolver.resolveHost().getPort());
+            Socket socket = new Socket();
+            socket.connect(inetSocketAddress, 30);
+            socket.close();
+            fail();

Review Comment:
   it is better to use a ephemeral port
   btw I am not convinced if it is worth to add such test.
   
   I believe that we can drop the test at all



-- 
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: commits-unsubscribe@pulsar.apache.org

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