[
https://issues.apache.org/jira/browse/KAFKA-1420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14070756#comment-14070756
]
Jonathan Natkins commented on KAFKA-1420:
-----------------------------------------
Hi Guozhang,
The particular case I'm confused by is a test like this:
{code:scala}
@Test
def testManualReplicaAssignment() {
val brokers = List(0, 1, 2, 3, 4)
TestUtils.createBrokersInZk(zkClient, brokers)
// duplicate brokers
intercept[IllegalArgumentException] {
AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK(zkClient,
"test", Map(0->Seq(0,0)))
}
// inconsistent replication factor
intercept[IllegalArgumentException] {
AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK(zkClient,
"test", Map(0->Seq(0,1), 1->Seq(0)))
}
// good assignment
val assignment = Map(0 -> List(0, 1, 2),
1 -> List(1, 2, 3))
AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK(zkClient, "test",
assignment)
val found = ZkUtils.getPartitionAssignmentForTopics(zkClient, Seq("test"))
assertEquals(assignment, found("test"))
}
{code}
This test uses createOrUpdate, but creates brokers via createBrokersInZk, which
doesn't return a reference to a KafkaServer.
The createTopic call, on the other hand, has two implementations:
{code:scala}
def createTopic(zkClient: ZkClient, topic: String, numPartitions: Int = 1,
replicationFactor: Int = 1,
servers: Seq[KafkaServer])
def createTopic(zkClient: ZkClient, topic: String, partitionReplicaAssignment:
collection.Map[Int, Seq[Int]],
servers: Seq[KafkaServer])
{scala}
In both cases, I need a Seq[KafkaServer]. It's unclear to me how to convert the
aforementioned test to use createTopic, without materially changing the
semantics of the test. Currently it doesn't use a real Kafka server, but to use
createTopic would require me to get a hold of some real servers.
How would a conversion like this be done? Hopefully this clarifies why I'm
confused.
> Replace AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK with
> TestUtils.createTopic in all unit tests
> --------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-1420
> URL: https://issues.apache.org/jira/browse/KAFKA-1420
> Project: Kafka
> Issue Type: Bug
> Reporter: Guozhang Wang
> Labels: newbie
> Fix For: 0.8.2
>
>
> This is a follow-up JIRA from KAFKA-1389
--
This message was sent by Atlassian JIRA
(v6.2#6252)