Browse Source

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

pull/38/merge
Joel Koshy 10 years ago
parent
commit
fcc2521858
  1. 10
      core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala

10
core/src/test/scala/unit/kafka/consumer/PartitionAssignorTest.scala

@ -187,10 +187,12 @@ private object PartitionAssignorTest extends Logging { @@ -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)
}
}
}

Loading…
Cancel
Save