mjsax commented on code in PR #16562:
URL: https://github.com/apache/kafka/pull/16562#discussion_r1686767176


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/DefaultStateUpdaterTest.java:
##########
@@ -325,14 +325,15 @@ private void 
shouldImmediatelyAddStatelessTasksToRestoredTasks(final StreamTask.
     public void shouldRestoreSingleActiveStatefulTask() throws Exception {
         final StreamTask task =
             statefulTask(TASK_0_0, mkSet(TOPIC_PARTITION_A_0, 
TOPIC_PARTITION_B_0)).inState(State.RESTORING).build();
+        final AtomicBoolean allChangelogCompleted = new AtomicBoolean(false);
         when(changelogReader.completedChangelogs())
             .thenReturn(Collections.emptySet())
             .thenReturn(mkSet(TOPIC_PARTITION_A_0))
-            .thenReturn(mkSet(TOPIC_PARTITION_A_0, TOPIC_PARTITION_B_0));
-        when(changelogReader.allChangelogsCompleted())
-            .thenReturn(false)
-            .thenReturn(false)
-            .thenReturn(true);
+            .thenAnswer(invocation -> {
+                allChangelogCompleted.set(true);
+                return mkSet(TOPIC_PARTITION_A_0, TOPIC_PARTITION_B_0);
+            });
+        
when(changelogReader.allChangelogsCompleted()).thenReturn(allChangelogCompleted.get());

Review Comment:
   Would we need a "return always" or do we know `allChangelogsCompleted` is 
only called exactly ones? -- The original code indicates it would be called 3 
times?



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