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



##########
File path: 
metadata/src/test/java/org/apache/kafka/metadata/PartitionRegistrationTest.java
##########
@@ -105,4 +105,42 @@ public void testToLeaderAndIsrPartitionState() {
                 setIsNew(false).toString(),
             b.toLeaderAndIsrPartitionState(new TopicPartition("bar", 0), 
false).toString());
     }
+
+    @Test
+    public void testMergePartitionChangeRecordWithReassignmentData() {
+        PartitionRegistration partition0 = new PartitionRegistration(new int[] 
{1, 2, 3},
+            new int[] {1, 2, 3}, Replicas.NONE, Replicas.NONE, 1, 100, 200);
+        PartitionRegistration partition1 = partition0.merge(new 
PartitionChangeRecord().
+            setRemovingReplicas(Collections.singletonList(3)).
+            setAddingReplicas(Collections.singletonList(4)).
+            setReplicas(Arrays.asList(1, 2, 3, 4)));
+        assertEquals(new PartitionRegistration(new int[] {1, 2, 3, 4},
+            new int[] {1, 2, 3}, new int[] {3}, new int[] {4}, 1, 100, 201), 
partition1);
+        PartitionRegistration partition2 = partition1.merge(new 
PartitionChangeRecord().
+            setIsr(Arrays.asList(1, 2, 4)).
+            setRemovingReplicas(Collections.emptyList()).
+            setAddingReplicas(Collections.emptyList()).
+            setReplicas(Arrays.asList(1, 2, 4)));
+        assertEquals(new PartitionRegistration(new int[] {1, 2, 4},
+            new int[] {1, 2, 4}, Replicas.NONE, Replicas.NONE, 1, 100, 202), 
partition2);
+        assertFalse(partition2.isReassigning());
+    }
+
+    @Test
+    public void testPartitionControlInfoIsrChangeCompletesReassignment() {
+        PartitionRegistration partition0 = new PartitionRegistration(
+            new int[]{1, 2, 3, 4}, new int[]{3}, new int[]{3}, new int[] {}, 
1, 0, 0);

Review comment:
       Good idea. But looking again, we can remove this test because the 
function has been shifted out of PartitionRegistration




-- 
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