lucasbru commented on code in PR #12771: URL: https://github.com/apache/kafka/pull/12771#discussion_r1004177386
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java: ########## @@ -1435,6 +1435,31 @@ public void shouldRethrowTaskCorruptedExceptionFromStateUpdater() { assertEquals("Tasks [0_1, 0_0] are corrupted and hence needs to be re-initialized", thrown.getMessage()); } + @Test + public void shouldRethrowTaskCorruptedExceptionFromInitialization() { + final StreamTask statefulTask0 = statefulTask(taskId00, taskId00ChangelogPartitions) + .inState(State.CREATED) + .withInputPartitions(taskId00Partitions).build(); + final StreamTask statefulTask1 = statefulTask(taskId01, taskId01ChangelogPartitions) + .inState(State.CREATED) + .withInputPartitions(taskId01Partitions).build(); + final TasksRegistry tasks = mock(TasksRegistry.class); + final TaskManager taskManager = setUpTaskManager(ProcessingMode.EXACTLY_ONCE_V2, tasks, true); + when(tasks.drainPendingTaskToInit()).thenReturn(mkSet(statefulTask0, statefulTask1)); + doThrow(new TaskCorruptedException(Collections.singleton(statefulTask0.id))).when(statefulTask0).initializeIfNeeded(); + doThrow(new TaskCorruptedException(Collections.singleton(statefulTask1.id))).when(statefulTask1).initializeIfNeeded(); + + final TaskCorruptedException thrown = assertThrows( + TaskCorruptedException.class, + () -> taskManager.checkStateUpdater(time.milliseconds(), noOpResetter) + ); + + Mockito.verify(tasks).addTask(statefulTask0); + Mockito.verify(tasks).addTask(statefulTask1); + assertEquals(mkSet(taskId00, taskId01), thrown.corruptedTasks()); + assertEquals("Tasks [0_1, 0_0] are corrupted and hence needs to be re-initialized", thrown.getMessage()); Review Comment: Done ########## streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java: ########## @@ -1435,6 +1435,31 @@ public void shouldRethrowTaskCorruptedExceptionFromStateUpdater() { assertEquals("Tasks [0_1, 0_0] are corrupted and hence needs to be re-initialized", thrown.getMessage()); } + @Test + public void shouldRethrowTaskCorruptedExceptionFromInitialization() { + final StreamTask statefulTask0 = statefulTask(taskId00, taskId00ChangelogPartitions) + .inState(State.CREATED) + .withInputPartitions(taskId00Partitions).build(); + final StreamTask statefulTask1 = statefulTask(taskId01, taskId01ChangelogPartitions) + .inState(State.CREATED) + .withInputPartitions(taskId01Partitions).build(); Review Comment: Done -- 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