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 03:29:27 UTC

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

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


##########
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:
   Seems this could be flaky? If the random port is open by coincidence.



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