cadonna commented on code in PR #13829:
URL: https://github.com/apache/kafka/pull/13829#discussion_r1222976522


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java:
##########
@@ -1970,6 +1970,29 @@ public void 
shouldThrowWhenHandlingClosingTasksOnProducerCloseError() {
         assertThat(thrown.getCause().getMessage(), is("KABOOM!"));
     }
 
+    @Test
+    public void shouldReAddRevivedTasksToStateUpdater() {
+        final StreamTask corruptedActiveTask = statefulTask(taskId03, 
taskId03ChangelogPartitions)
+            .inState(State.RESTORING)
+            .withInputPartitions(taskId03Partitions).build();
+        final StandbyTask corruptedStandbyTask = standbyTask(taskId02, 
taskId02ChangelogPartitions)
+            .inState(State.RUNNING)
+            .withInputPartitions(taskId02Partitions).build();
+        final TasksRegistry tasks = Mockito.mock(TasksRegistry.class);
+        final TaskManager taskManager = 
setUpTaskManager(ProcessingMode.AT_LEAST_ONCE, tasks, true);
+        when(tasks.task(taskId03)).thenReturn( corruptedActiveTask);
+        when(tasks.task(taskId02)).thenReturn( corruptedStandbyTask);
+        expect(consumer.assignment()).andReturn(emptySet());
+        replay(consumer);
+
+        taskManager.handleCorruption(mkSet(corruptedActiveTask.id(), 
corruptedStandbyTask.id()));
+
+        Mockito.verify(tasks).removeTask(corruptedActiveTask);

Review Comment:
   The task is a mock. The state of the task is specified by the test. However, 
I added verifications for the method calls that change the state of the task. 



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