You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by mj...@apache.org on 2024/08/23 01:45:05 UTC

(kafka) branch trunk updated: KAFKA-17371: Fix DefaultTaskExecutorTest.shouldUnassignTaskWhenRequired (#16941)

This is an automated email from the ASF dual-hosted git repository.

mjsax pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 46597638eee KAFKA-17371: Fix DefaultTaskExecutorTest.shouldUnassignTaskWhenRequired (#16941)
46597638eee is described below

commit 46597638eeee15d2d572d79cba9645e467a16d98
Author: TengYao Chi <ki...@gmail.com>
AuthorDate: Fri Aug 23 09:44:58 2024 +0800

    KAFKA-17371: Fix DefaultTaskExecutorTest.shouldUnassignTaskWhenRequired (#16941)
    
    Reviewers: Matthias J. Sax <ma...@confluent.io>
---
 .../streams/processor/internals/tasks/DefaultTaskExecutorTest.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/streams/src/test/java/org/apache/kafka/streams/processor/internals/tasks/DefaultTaskExecutorTest.java b/streams/src/test/java/org/apache/kafka/streams/processor/internals/tasks/DefaultTaskExecutorTest.java
index 7ee1f247934..a538cdf66d0 100644
--- a/streams/src/test/java/org/apache/kafka/streams/processor/internals/tasks/DefaultTaskExecutorTest.java
+++ b/streams/src/test/java/org/apache/kafka/streams/processor/internals/tasks/DefaultTaskExecutorTest.java
@@ -24,6 +24,7 @@ import org.apache.kafka.streams.errors.StreamsException;
 import org.apache.kafka.streams.processor.TaskId;
 import org.apache.kafka.streams.processor.internals.StreamTask;
 import org.apache.kafka.streams.processor.internals.TaskExecutionMetadata;
+import org.apache.kafka.test.TestUtils;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -35,7 +36,6 @@ import java.util.Collections;
 import static org.apache.kafka.test.TestUtils.waitForCondition;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
@@ -230,7 +230,9 @@ public class DefaultTaskExecutorTest {
         taskExecutor.start();
 
         verify(taskManager, timeout(VERIFICATION_TIMEOUT)).assignNextTask(taskExecutor);
-        assertNotNull(taskExecutor.currentTask());
+        TestUtils.waitForCondition(() -> taskExecutor.currentTask() != null,
+                VERIFICATION_TIMEOUT,
+                "Task reassign take too much time");
 
         final KafkaFuture<StreamTask> future = taskExecutor.unassign();