showuon commented on a change in pull request #9629: URL: https://github.com/apache/kafka/pull/9629#discussion_r527741948
########## File path: streams/src/test/java/org/apache/kafka/streams/integration/StreamsUncaughtExceptionHandlerIntegrationTest.java ########## @@ -110,83 +110,45 @@ public void teardown() throws IOException { } @Test - public void shouldShutdownThreadUsingOldHandler() throws Exception { + public void shouldShutdownThreadUsingOldHandler() throws InterruptedException { try (final KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), properties)) { - final CountDownLatch latch = new CountDownLatch(1); final AtomicBoolean flag = new AtomicBoolean(false); kafkaStreams.setUncaughtExceptionHandler((t, e) -> flag.set(true)); StreamsTestUtils.startKafkaStreamsAndWaitForRunningState(kafkaStreams); - produceMessages(0L, inputTopic, "A"); - waitForApplicationState(Collections.singletonList(kafkaStreams), KafkaStreams.State.ERROR, Duration.ofSeconds(15)); TestUtils.waitForCondition(flag::get, "Handler was called"); + waitForApplicationState(Collections.singletonList(kafkaStreams), KafkaStreams.State.ERROR, DEFAULT_DURATION); Review comment: We should wait for the `uncaughtExceptionHandler` got called before waiting for the streams state change. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org