brandboat commented on code in PR #18983: URL: https://github.com/apache/kafka/pull/18983#discussion_r1977713877
########## metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java: ########## @@ -1922,6 +1922,135 @@ public void testReassignPartitions(short version) { assertEquals(NONE_REASSIGNING, replication.listPartitionReassignments(null, Long.MAX_VALUE)); } + @ParameterizedTest + @ApiKeyVersionsSource(apiKey = ApiKeys.ALTER_PARTITION) + public void testAlterPartitionDisallowReplicationFactorChange(short version) { + MetadataVersion metadataVersion = MetadataVersion.latestTesting(); + ReplicationControlTestContext ctx = new ReplicationControlTestContext.Builder() + .setMetadataVersion(metadataVersion) + .build(); + ReplicationControlManager replication = ctx.replicationControl; + ctx.registerBrokers(0, 1, 2, 3); + ctx.unfenceBrokers(0, 1, 2, 3); + ctx.createTestTopic("foo", new int[][] {new int[] {0, 1, 2}, new int[] {0, 1, 2}, new int[] {0, 1, 2}}); + + ControllerResult<AlterPartitionReassignmentsResponseData> alterResult = + replication.alterPartitionReassignments( + new AlterPartitionReassignmentsRequestData().setTopics(singletonList( + new ReassignableTopic().setName("foo").setPartitions(asList( + new ReassignablePartition().setPartitionIndex(0). + setReplicas(asList(1, 2, 3)), Review Comment: I've given this some thought, and I agree with you that List.of is a better choice. However, since this test class consistently uses Arrays.asList, perhaps we can open a separate minor PR to address this improvement. As you suggested, we can replace asList with List.of in this test class. -- 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