cadonna commented on code in PR #12466: URL: https://github.com/apache/kafka/pull/12466#discussion_r944502639
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java: ########## @@ -296,6 +296,75 @@ public void shouldAddTasksToStateUpdater() { Mockito.verify(stateUpdater).add(task01); } + @Test + public void shouldHandleRemovedTasksFromStateUpdater() { + // tasks to recycle + final StreamTask task00 = mock(StreamTask.class); + final StandbyTask task01 = mock(StandbyTask.class); + final StandbyTask task00Converted = mock(StandbyTask.class); + final StreamTask task01Converted = mock(StreamTask.class); + // task to close + final StreamTask task02 = mock(StreamTask.class); + // task to update inputs + final StreamTask task03 = mock(StreamTask.class); + when(task00.id()).thenReturn(taskId00); + when(task01.id()).thenReturn(taskId01); + when(task02.id()).thenReturn(taskId02); + when(task03.id()).thenReturn(taskId03); + when(task00.inputPartitions()).thenReturn(taskId00Partitions); + when(task01.inputPartitions()).thenReturn(taskId01Partitions); + when(task02.inputPartitions()).thenReturn(taskId02Partitions); + when(task03.inputPartitions()).thenReturn(taskId03Partitions); + when(task00.isActive()).thenReturn(true); + when(task01.isActive()).thenReturn(false); + when(task02.isActive()).thenReturn(true); + when(task03.isActive()).thenReturn(true); + when(task00.state()).thenReturn(State.RESTORING); + when(task01.state()).thenReturn(State.RUNNING); + when(task02.state()).thenReturn(State.RESTORING); + when(task03.state()).thenReturn(State.RESTORING); Review Comment: I opened https://github.com/apache/kafka/pull/12510 for extending the mock task builder. If you think it makes sense you could approve and merge https://github.com/apache/kafka/pull/12510, rebase this PR and use the builder here. -- 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