chia7712 commented on code in PR #19884: URL: https://github.com/apache/kafka/pull/19884#discussion_r2141350592
########## test-common/test-common-runtime/src/main/java/org/apache/kafka/common/test/junit/RaftClusterInvocationContext.java: ########## @@ -71,6 +70,48 @@ public class RaftClusterInvocationContext implements TestTemplateInvocationConte private final ClusterConfig clusterConfig; private final boolean isCombined; + // Copied from TestUtils (package-private) + private static final long DEFAULT_POLL_INTERVAL_MS = 100; + private static final long DEFAULT_MAX_WAIT_MS = 15_000; + + /** + * Wait for condition to be met for at most {@code maxWaitMs} and throw assertion failure otherwise. + * This should be used instead of {@code Thread.sleep} whenever possible as it allows a longer timeout to be used + * without unnecessarily increasing test time (as the condition is checked frequently). The longer timeout is needed to + * avoid transient failures due to slow or overloaded machines. + */ + static void waitForCondition(final java.util.function.Supplier<Boolean> testCondition, Review Comment: we don't need the variety of `waitForCondition`, right? -- 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