xiangfu0 commented on a change in pull request #6872: URL: https://github.com/apache/incubator-pinot/pull/6872#discussion_r626298493
########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/ZkStarter.java ########## @@ -34,16 +35,22 @@ public class ZkStarter { private static final Logger LOGGER = LoggerFactory.getLogger(ZkStarter.class); public static final int DEFAULT_ZK_TEST_PORT = 2191; - public static final String DEFAULT_ZK_STR = "localhost:" + DEFAULT_ZK_TEST_PORT; private static final int DEFAULT_ZK_CLIENT_RETRIES = 10; + private static int ZK_TEST_PORT = 2191; Review comment: done ########## File path: pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/ClusterTest.java ########## @@ -125,6 +128,15 @@ protected void startBrokers(int numBrokers, int basePort, String zkStr) brokerStarter.start(); _brokerStarters.add(brokerStarter); } + _brokerBaseApiUrl = "http://localhost:" + _brokerPorts.get(0); + } + + protected int getBrokerPort(int index) { Review comment: this actually keeps the old behavior, updated the logic to return a random port. ########## File path: pinot-spi/src/main/java/org/apache/pinot/spi/utils/NetUtils.java ########## @@ -57,4 +59,62 @@ public static String getHostnameOrAddress() { } } } + + /** + * Find an open port. + * @return an open port + * @throws IOException + */ + public static int findOpenPort() + throws IOException { + try (ServerSocket socket = new ServerSocket(0)) { + return socket.getLocalPort(); + } + } + + /** + * Find an open port,otherwise use given default port. Review comment: done. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org