cmccabe commented on a change in pull request #10753:
URL: https://github.com/apache/kafka/pull/10753#discussion_r669944074



##########
File path: core/src/test/scala/integration/kafka/server/RaftClusterTest.scala
##########
@@ -422,4 +351,75 @@ class RaftClusterTest {
       listenerName = listenerName
     )
 
+  @Test
+  def testCreateClusterAndPerformReassignment(): Unit = {
+    val cluster = new KafkaClusterTestKit.Builder(
+      new TestKitNodes.Builder().
+        setNumBrokerNodes(4).
+        setNumControllerNodes(3).build()).build()
+    try {
+      cluster.format()
+      cluster.startup()
+      cluster.waitForReadyBrokers()
+      val admin = Admin.create(cluster.clientProperties())
+      try {
+        // Create the topic.
+        val assignments = new util.HashMap[Integer, util.List[Integer]]
+        assignments.put(0, Arrays.asList(0, 1, 2))
+        assignments.put(1, Arrays.asList(1, 2, 3))
+        assignments.put(2, Arrays.asList(2, 3, 0))
+        val createTopicResult = admin.createTopics(Collections.singletonList(
+          new NewTopic("foo", assignments)))
+        createTopicResult.all().get()
+        waitForTopicListing(admin, Seq("foo"), Seq())
+
+        // Start some reassignments.
+        assertEquals(Collections.emptyMap(), 
admin.listPartitionReassignments().reassignments().get())
+        val reassignments = new util.HashMap[TopicPartition, 
Optional[NewPartitionReassignment]]
+        reassignments.put(new TopicPartition("foo", 0),
+          Optional.of(new NewPartitionReassignment(Arrays.asList(2, 1, 0))))
+        reassignments.put(new TopicPartition("foo", 1),
+          Optional.of(new NewPartitionReassignment(Arrays.asList(0, 1, 2))))

Review comment:
       Good idea




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to