kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject git commit: kafka-1418; transient unit test failure in ProducerFailureHandlingTest; patched by Jun Rao; reviewed by Guozhang Wang and Joel Koshy
Date Thu, 24 Apr 2014 22:23:50 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 0efdfa6f7 -> 3ebbaaea9


kafka-1418; transient unit test failure in ProducerFailureHandlingTest; patched by Jun Rao;
reviewed by Guozhang Wang and Joel Koshy


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

Branch: refs/heads/trunk
Commit: 3ebbaaea99d9ce94026fb1eef7d024839cf2e436
Parents: 0efdfa6
Author: Jun Rao <junrao@gmail.com>
Authored: Thu Apr 24 15:23:42 2014 -0700
Committer: Jun Rao <junrao@gmail.com>
Committed: Thu Apr 24 15:23:42 2014 -0700

----------------------------------------------------------------------
 .../scala/integration/kafka/api/ProducerCompressionTest.scala  | 4 +++-
 .../integration/kafka/api/ProducerFailureHandlingTest.scala    | 6 +++---
 .../unit/kafka/integration/UncleanLeaderElectionTest.scala     | 2 +-
 core/src/test/scala/unit/kafka/producer/ProducerTest.scala     | 6 ++++++
 4 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/3ebbaaea/core/src/test/scala/integration/kafka/api/ProducerCompressionTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/integration/kafka/api/ProducerCompressionTest.scala b/core/src/test/scala/integration/kafka/api/ProducerCompressionTest.scala
index 2dad20e..17e2c6e 100644
--- a/core/src/test/scala/integration/kafka/api/ProducerCompressionTest.scala
+++ b/core/src/test/scala/integration/kafka/api/ProducerCompressionTest.scala
@@ -74,6 +74,7 @@ class ProducerCompressionTest(compression: String) extends JUnit3Suite with
ZooK
     props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, TestUtils.getBrokerListStrFromConfigs(Seq(config)))
     props.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, compression)
     var producer = new KafkaProducer(props)
+    val consumer = new SimpleConsumer("localhost", port, 100, 1024*1024, "")
 
     try {
       // create topic
@@ -93,7 +94,6 @@ class ProducerCompressionTest(compression: String) extends JUnit3Suite with
ZooK
       }
 
       // make sure the fetched message count match
-      val consumer = new SimpleConsumer("localhost", port, 100, 1024*1024, "")
       val fetchResponse = consumer.fetch(new FetchRequestBuilder().addFetch(topic, partition,
0, Int.MaxValue).build())
       val messageSet = fetchResponse.messageSet(topic, partition).iterator.toBuffer
       assertEquals("Should have fetched " + numRecords + " messages", numRecords, messageSet.size)
@@ -109,6 +109,8 @@ class ProducerCompressionTest(compression: String) extends JUnit3Suite
with ZooK
         producer.close()
         producer = null
       }
+      if (consumer != null)
+        consumer.close()
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/3ebbaaea/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala b/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala
index 24125e2..839fd27 100644
--- a/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala
+++ b/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala
@@ -92,9 +92,6 @@ class ProducerFailureHandlingTest extends JUnit3Suite with ZooKeeperTestHarness
   }
 
   override def tearDown() {
-    server1.shutdown; Utils.rm(server1.config.logDirs)
-    server2.shutdown; Utils.rm(server2.config.logDirs)
-
     consumer1.close
     consumer2.close
 
@@ -103,6 +100,9 @@ class ProducerFailureHandlingTest extends JUnit3Suite with ZooKeeperTestHarness
     if (producer3 != null) producer3.close
     if (producer4 != null) producer4.close
 
+    server1.shutdown; Utils.rm(server1.config.logDirs)
+    server2.shutdown; Utils.rm(server2.config.logDirs)
+
     super.tearDown()
   }
 

http://git-wip-us.apache.org/repos/asf/kafka/blob/3ebbaaea/core/src/test/scala/unit/kafka/integration/UncleanLeaderElectionTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/integration/UncleanLeaderElectionTest.scala b/core/src/test/scala/unit/kafka/integration/UncleanLeaderElectionTest.scala
index 1b11eb6..d1d969e 100644
--- a/core/src/test/scala/unit/kafka/integration/UncleanLeaderElectionTest.scala
+++ b/core/src/test/scala/unit/kafka/integration/UncleanLeaderElectionTest.scala
@@ -253,7 +253,7 @@ class UncleanLeaderElectionTest extends JUnit3Suite with ZooKeeperTestHarness
{
   private def produceMessage(topic: String, message: String) = {
     val props = new Properties()
     props.put("request.required.acks", String.valueOf(-1))
-	val producer: Producer[String, Array[Byte]] = createProducer(getBrokerListStrFromConfigs(configs),
+    val producer: Producer[String, Array[Byte]] = createProducer(getBrokerListStrFromConfigs(configs),
       new DefaultEncoder(), new StringEncoder(), props)
     producer.send(new KeyedMessage[String, Array[Byte]](topic, topic, message.getBytes))
     producer.close()

http://git-wip-us.apache.org/repos/asf/kafka/blob/3ebbaaea/core/src/test/scala/unit/kafka/producer/ProducerTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/producer/ProducerTest.scala b/core/src/test/scala/unit/kafka/producer/ProducerTest.scala
index c1219a8..dc6a5ea 100644
--- a/core/src/test/scala/unit/kafka/producer/ProducerTest.scala
+++ b/core/src/test/scala/unit/kafka/producer/ProducerTest.scala
@@ -76,6 +76,12 @@ class ProducerTest extends JUnit3Suite with ZooKeeperTestHarness with Logging{
   override def tearDown() {
     // restore set request handler logger to a higher level
     requestHandlerLogger.setLevel(Level.ERROR)
+
+    if (consumer1 != null)
+      consumer1.close()
+    if (consumer2 != null)
+      consumer2.close()
+
     server1.shutdown
     server2.shutdown
     Utils.rm(server1.config.logDirs)


Mime
View raw message