You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/10/01 09:33:34 UTC

[GitHub] [kafka] mimaison commented on a change in pull request #9281: KAFKA-10478: Allow duplicated ports in advertised.listeners

mimaison commented on a change in pull request #9281:
URL: https://github.com/apache/kafka/pull/9281#discussion_r498109261



##########
File path: core/src/test/scala/unit/kafka/server/KafkaConfigTest.scala
##########
@@ -218,16 +220,26 @@ class KafkaConfigTest {
     props.put(KafkaConfig.ZkConnectProp, "localhost:2181")
 
     // listeners with duplicate port
-    props.put(KafkaConfig.ListenersProp, "PLAINTEXT://localhost:9091,TRACE://localhost:9091")
-    assertFalse(isValidKafkaConfig(props))
+    props.put(KafkaConfig.ListenersProp, "PLAINTEXT://localhost:9091,SSL://localhost:9091")
+    var caught = intercept[IllegalArgumentException] { KafkaConfig.fromProps(props) }
+    assertThat(caught.getMessage(), containsString("Each listener must have a different port"))

Review comment:
       Can we use something like:
   ```
   assertTrue(caught.getMessage.contains("Each listener must have a different port"))
   ```
   That way we don't need to import hamcrest and only use junit.
   
   This can be applied to all `assertThat()` added in this PR




----------------------------------------------------------------
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:
users@infra.apache.org