C0urante commented on code in PR #13375:
URL: https://github.com/apache/kafka/pull/13375#discussion_r1144924243


##########
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectWorkerIntegrationTest.java:
##########
@@ -195,7 +197,22 @@ public void testRestartFailedTask() throws Exception {
     public void testBrokerCoordinator() throws Exception {
         ConnectorHandle connectorHandle = 
RuntimeHandles.get().connectorHandle(CONNECTOR_NAME);
         
workerProps.put(DistributedConfig.SCHEDULED_REBALANCE_MAX_DELAY_MS_CONFIG, 
String.valueOf(5000));
-        connect = connectBuilder.workerProps(workerProps).build();
+        Properties brokerProps = new Properties();
+
+        // Find a free port and use it in the Kafka broker's listeners config. 
We can't use port 0 in the listeners
+        // config to get a random free port because in this test we want to 
stop the Kafka broker and then bring it
+        // back up and listening on the same port in order to verify that the 
Connect cluster can re-connect to Kafka
+        // and continue functioning normally. If we were to use port 0 here, 
the Kafka broker would most likely listen
+        // on a different random free port the second time it is started.

Review Comment:
   Fair enough, that works for me!
   The one small change I'd like to see is that, in tests where we set 
listeners with a fixed non-zero port, we make sure to explicitly set the number 
of brokers to one (I know that this matches the current default, but we may 
change the default, and it'd be nice to make this test resilient against that).



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to