You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ju...@apache.org on 2015/03/04 01:53:58 UTC

kafka git commit: kafka-1999; Fix failing unit-test: kafka.api.ProducerFailureHandlingTest > testNotEnoughReplicasAfterBrokerShutdown; patched by Gwen Shapira; reviewed by Jun Rao

Repository: kafka
Updated Branches:
  refs/heads/trunk 4c9ad9b8a -> 151ae42cd


kafka-1999; Fix failing unit-test: kafka.api.ProducerFailureHandlingTest > testNotEnoughReplicasAfterBrokerShutdown; patched by Gwen Shapira; reviewed by Jun Rao


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

Branch: refs/heads/trunk
Commit: 151ae42cdf2f54d83563da7c90cd087b99300408
Parents: 4c9ad9b
Author: Gwen Shapira <cs...@gmail.com>
Authored: Tue Mar 3 16:53:50 2015 -0800
Committer: Jun Rao <ju...@gmail.com>
Committed: Tue Mar 3 16:53:50 2015 -0800

----------------------------------------------------------------------
 .../integration/kafka/api/ProducerFailureHandlingTest.scala  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/151ae42c/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 ba48a63..d34ee3a 100644
--- a/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala
+++ b/core/src/test/scala/integration/kafka/api/ProducerFailureHandlingTest.scala
@@ -32,7 +32,7 @@ import kafka.integration.KafkaServerTestHarness
 import kafka.utils.{TestZKUtils, ShutdownableThread, TestUtils}
 
 import org.apache.kafka.common.KafkaException
-import org.apache.kafka.common.errors.{InvalidTopicException, NotEnoughReplicasException}
+import org.apache.kafka.common.errors.{InvalidTopicException, NotEnoughReplicasException, NotEnoughReplicasAfterAppendException}
 import org.apache.kafka.clients.producer._
 
 class ProducerFailureHandlingTest extends KafkaServerTestHarness {
@@ -348,8 +348,10 @@ class ProducerFailureHandlingTest extends KafkaServerTestHarness {
       fail("Expected exception when producing to topic with fewer brokers than min.insync.replicas")
     } catch {
       case e: ExecutionException =>
-        if (!e.getCause.isInstanceOf[NotEnoughReplicasException]) {
-          fail("Expected NotEnoughReplicasException when producing to topic with fewer brokers than min.insync.replicas")
+        if (!e.getCause.isInstanceOf[NotEnoughReplicasException]  &&
+            !e.getCause.isInstanceOf[NotEnoughReplicasAfterAppendException]) {
+          fail("Expected NotEnoughReplicasException or NotEnoughReplicasAfterAppendException when producing to topic " +
+            "with fewer brokers than min.insync.replicas, but saw " + e.getCause)
         }
     }