kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jjko...@apache.org
Subject kafka git commit: KAFKA-1823; Fix transient failure in PartitionAssignorTest; reviewed by Guozhang Wang and Neha Narkhede
Date Tue, 20 Jan 2015 21:14:16 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 5d648cfdb -> fcc252185


KAFKA-1823; Fix transient failure in PartitionAssignorTest; reviewed by Guozhang Wang and
Neha Narkhede


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

Branch: refs/heads/trunk
Commit: fcc2521858efd1bd99e06c319de9489330125a4d
Parents: 5d648cf
Author: Joel Koshy <jjkoshy@gmail.com>
Authored: Tue Jan 20 13:13:50 2015 -0800
Committer: Joel Koshy <jjkoshy@gmail.com>
Committed: Tue Jan 20 13:13:50 2015 -0800

----------------------------------------------------------------------
 .../scala/unit/kafka/consumer/PartitionAssignorTest.scala | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/fcc25218/core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala b/core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala
index 24954de..543070f 100644
--- a/core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala
+++ b/core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala
@@ -187,10 +187,12 @@ private object PartitionAssignorTest extends Logging {
     // check for uniform assignment
     if (verifyAssignmentIsUniform) {
       val partitionCountForStream = partitionCountPerStream(globalAssignment)
-      val maxCount = partitionCountForStream.valuesIterator.max
-      val minCount = partitionCountForStream.valuesIterator.min
-      assertTrue("Scenario %s: assignment is not uniform (partition counts per stream are
in the range [%d, %d])"
-                 .format(scenario, minCount, maxCount), (maxCount - minCount) <= 1)
+      if (partitionCountForStream.nonEmpty) {
+        val maxCount = partitionCountForStream.valuesIterator.max
+        val minCount = partitionCountForStream.valuesIterator.min
+        assertTrue("Scenario %s: assignment is not uniform (partition counts per stream are
in the range [%d, %d])"
+          .format(scenario, minCount, maxCount), (maxCount - minCount) <= 1)
+      }
     }
   }
 


Mime
View raw message