kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject kafka git commit: MINOR: Fix issue in `AsyncProducerTest` where it expects the `port` config to be set
Date Tue, 01 Nov 2016 15:42:11 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 76b070284 -> 979a7baa7


MINOR: Fix issue in `AsyncProducerTest` where it expects the `port` config to be set

This test fails locally when I run it, but somehow Jenkins builds are passed. Not clear how.

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Jason Gustafson <jason@confluent.io>

Closes #2073 from ijuma/async-producer-test-port-config


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/979a7baa
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/979a7baa
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/979a7baa

Branch: refs/heads/trunk
Commit: 979a7baa7b3039060d1a788ae179dc3593c6821e
Parents: 76b0702
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Tue Nov 1 08:41:58 2016 -0700
Committer: Jason Gustafson <jason@confluent.io>
Committed: Tue Nov 1 08:41:58 2016 -0700

----------------------------------------------------------------------
 .../scala/unit/kafka/producer/AsyncProducerTest.scala    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/979a7baa/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala b/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
index 3093b93..e84c498 100755
--- a/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
+++ b/core/src/test/scala/unit/kafka/producer/AsyncProducerTest.scala
@@ -19,7 +19,8 @@ package kafka.producer
 
 import java.util.Properties
 import java.util.concurrent.LinkedBlockingQueue
-import org.apache.kafka.common.protocol.Errors
+
+import org.apache.kafka.common.protocol.{Errors, SecurityProtocol}
 import org.junit.Assert._
 import org.easymock.EasyMock
 import org.junit.Test
@@ -31,6 +32,7 @@ import kafka.producer.async._
 import kafka.serializer._
 import kafka.server.KafkaConfig
 import kafka.utils.TestUtils._
+
 import scala.collection.Map
 import scala.collection.mutable.ArrayBuffer
 import kafka.utils._
@@ -43,9 +45,12 @@ class AsyncProducerTest {
   }
 
   // One of the few cases we can just set a fixed port because the producer is mocked out
here since this uses mocks
-  val props = Seq(createBrokerConfig(1, "127.0.0.1:1", port=65534))
+  val props = Seq(createBrokerConfig(1, "127.0.0.1:1", port = 65534))
   val configs = props.map(KafkaConfig.fromProps)
-  val brokerList = configs.map(c => org.apache.kafka.common.utils.Utils.formatAddress(c.hostName,
c.port)).mkString(",")
+  val brokerList = configs.map { config =>
+    val endPoint = config.advertisedListeners.get(SecurityProtocol.PLAINTEXT).get
+    org.apache.kafka.common.utils.Utils.formatAddress(endPoint.host, endPoint.port)
+  }.mkString(",")
 
   @Test
   def testProducerQueueSize() {


Mime
View raw message