brandboat commented on code in PR #18983: URL: https://github.com/apache/kafka/pull/18983#discussion_r1976667995
########## core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala: ########## @@ -3452,11 +3452,26 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest { val tp3 = new TopicPartition(topic, 2) createTopic(topic, numPartitions = 4) - val validAssignment = Optional.of(new NewPartitionReassignment( (0 until brokerCount).map(_.asInstanceOf[Integer]).asJava )) + val alterOptions = new AlterPartitionReassignmentsOptions + alterOptions.allowReplicationFactorChange(false) + val alterReplicaNumberTo1 = Optional.of(new NewPartitionReassignment(List(1.asInstanceOf[Integer]).asJava)) + val alterReplicaNumberTo2 = Optional.of(new NewPartitionReassignment((0 until brokerCount - 1).map(_.asInstanceOf[Integer]).asJava)) + val alterReplicaNumberTo3 = Optional.of(new NewPartitionReassignment((0 until brokerCount).map(_.asInstanceOf[Integer]).asJava)) + val alterReplicaResults = client.alterPartitionReassignments(Map( + tp1 -> alterReplicaNumberTo1, + tp2 -> alterReplicaNumberTo2, + tp3 -> alterReplicaNumberTo3, + ).asJava, alterOptions).values() + assertDoesNotThrow(() => alterReplicaResults.get(tp1).get()) + assertEquals("The replication factor is changed from 1 to 2", + assertFutureThrows(classOf[InvalidReplicationFactorException], alterReplicaResults.get(tp2)).getMessage) + assertEquals("The replication factor is changed from 1 to 3", Review Comment: Sure! I modify the replication factor from 1 to 2 in this test case. -- 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