chia7712 commented on code in PR #19628: URL: https://github.com/apache/kafka/pull/19628#discussion_r2073346146
########## storage/src/test/java/org/apache/kafka/storage/internals/log/RemoteIndexCacheTest.java: ########## @@ -376,8 +376,13 @@ public void testCleanerThreadShutdown() throws IOException, InterruptedException // close the cache properly cache.close(); // verify that the thread is closed properly - threads = getRunningCleanerThread(); - assertTrue(threads.isEmpty(), "Found unexpected " + threads.size() + " threads=" + threads.stream().map(Thread::getName).collect(Collectors.joining(", "))); + TestUtils.waitForCondition( Review Comment: ```java TestUtils.waitForCondition( () -> getRunningCleanerThread().isEmpty(), () -> "Failed while waiting for cleaner threads to shutdown. Remaining threads: " + getRunningCleanerThread().stream().map(Thread::getName).collect(Collectors.joining(", "))); ``` -- 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