showuon commented on a change in pull request #10872:
URL: https://github.com/apache/kafka/pull/10872#discussion_r652324325



##########
File path: 
connect/runtime/src/test/java/org/apache/kafka/connect/util/clusters/EmbeddedKafkaCluster.java
##########
@@ -123,24 +123,23 @@ public void start() {
     }
 
     private void start(int[] brokerPorts, String[] logDirs) {
-        brokerConfig.put(KafkaConfig$.MODULE$.ZkConnectProp(), 
zKConnectString());
+        brokerConfig.put(KafkaConfig.ZkConnectProp(), zKConnectString());
 
-        putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.HostNameProp(), 
"localhost");
-        putIfAbsent(brokerConfig, 
KafkaConfig$.MODULE$.DeleteTopicEnableProp(), true);
-        putIfAbsent(brokerConfig, 
KafkaConfig$.MODULE$.GroupInitialRebalanceDelayMsProp(), 0);
-        putIfAbsent(brokerConfig, 
KafkaConfig$.MODULE$.OffsetsTopicReplicationFactorProp(), (short) 
brokers.length);
-        putIfAbsent(brokerConfig, 
KafkaConfig$.MODULE$.AutoCreateTopicsEnableProp(), false);
+        putIfAbsent(brokerConfig, KafkaConfig.DeleteTopicEnableProp(), true);
+        putIfAbsent(brokerConfig, 
KafkaConfig.GroupInitialRebalanceDelayMsProp(), 0);
+        putIfAbsent(brokerConfig, 
KafkaConfig.OffsetsTopicReplicationFactorProp(), (short) brokers.length);
+        putIfAbsent(brokerConfig, KafkaConfig.AutoCreateTopicsEnableProp(), 
false);
 
-        Object listenerConfig = 
brokerConfig.get(KafkaConfig$.MODULE$.InterBrokerListenerNameProp());
+        Object listenerConfig = 
brokerConfig.get(KafkaConfig.InterBrokerListenerNameProp());
         if (listenerConfig != null) {
             listenerName = new ListenerName(listenerConfig.toString());
         }
 
         for (int i = 0; i < brokers.length; i++) {
-            brokerConfig.put(KafkaConfig$.MODULE$.BrokerIdProp(), i);
+            brokerConfig.put(KafkaConfig.BrokerIdProp(), i);
             currentBrokerLogDirs[i] = logDirs[i] == null ? createLogDir() : 
currentBrokerLogDirs[i];
-            brokerConfig.put(KafkaConfig$.MODULE$.LogDirProp(), 
currentBrokerLogDirs[i]);
-            brokerConfig.put(KafkaConfig$.MODULE$.PortProp(), brokerPorts[i]);
+            brokerConfig.put(KafkaConfig.LogDirProp(), 
currentBrokerLogDirs[i]);
+            putIfAbsent(brokerConfig, KafkaConfig.ListenersProp(), 
"PLAINTEXT://localhost:" + brokerPorts[i]);

Review comment:
       @ijuma , I found why the test `testBrokerCoordinator` failed. It's 
because we use `putIfAbsent` here, but in the `testBrokerCoordinator`, we want 
to bind previous allocated port [line 
114](https://github.com/apache/kafka/pull/10872/files#diff-234389ba52863064119a9fbb8d1649d6a039a28790b7c186357e60570b0af049L114).
 If we use `putIfAbsent` here, it'll use default port `0` to have a random 
assigned port as [line 
120](https://github.com/apache/kafka/pull/10872/files#diff-234389ba52863064119a9fbb8d1649d6a039a28790b7c186357e60570b0af049R120).
 So, we should directly `put` property here to fix it. FYI




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


Reply via email to