cadonna commented on a change in pull request #11083: URL: https://github.com/apache/kafka/pull/11083#discussion_r673154289
########## File path: streams/src/test/java/org/apache/kafka/streams/integration/TaskMetadataIntegrationTest.java ########## @@ -158,10 +159,13 @@ public void shouldReportCorrectEndOffsetInformation() { } } - private TaskMetadata getTaskMetadata(final KafkaStreams kafkaStreams) { - final List<TaskMetadata> taskMetadataList = kafkaStreams.metadataForLocalThreads().stream().flatMap(t -> t.activeTasks().stream()).collect(Collectors.toList()); - assertThat("only one task", taskMetadataList.size() == 1); - return taskMetadataList.get(0); + private TaskMetadata getTaskMetadata(final KafkaStreams kafkaStreams) throws InterruptedException { + AtomicReference<List<TaskMetadata>> taskMetadataList = new AtomicReference<>(); + TestUtils.waitForCondition( () -> { + taskMetadataList.set(kafkaStreams.metadataForLocalThreads().stream().flatMap(t -> t.activeTasks().stream()).collect(Collectors.toList())); + return taskMetadataList.get().size() == 1; + }, "The active tasks returned was not one in the allotted time."); Review comment: ```suggestion }, "The number of active tasks returned in the allotted time was not one."); ``` -- 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