vpapavas commented on a change in pull request #11581: URL: https://github.com/apache/kafka/pull/11581#discussion_r766731204
########## File path: streams/src/test/java/org/apache/kafka/streams/integration/utils/IntegrationTestUtils.java ########## @@ -125,22 +128,81 @@ final long deadline = start + DEFAULT_TIMEOUT; do { + if (Thread.currentThread().isInterrupted()) { + fail("Test was interrupted."); + } final StateQueryResult<R> result = kafkaStreams.query(request); - if (result.getPartitionResults().keySet().containsAll(partitions) - || result.getGlobalResult() != null) { + if (result.getPartitionResults().keySet().containsAll(partitions)) { return result; } else { - try { - Thread.sleep(100L); - } catch (final InterruptedException e) { - throw new RuntimeException(e); - } + sleep(100L); } } while (System.currentTimeMillis() < deadline); throw new TimeoutException("The query never returned the desired partitions"); } + /** + * Repeatedly runs the query until the response is valid and then return the response. + * <p> + * Validity in this case means that the response position is up to the specified bound. + * <p> + * Once position bounding is generally supported, we should migrate tests to wait on the + * expected response position. + */ + public static <R> StateQueryResult<R> iqv2WaitForResult( Review comment: Nice! -- 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