gnodet commented on code in PR #24416:
URL: https://github.com/apache/camel/pull/24416#discussion_r3523523194
##########
components/camel-wal/src/test/java/org/apache/camel/component/wal/LogWriterRollOverUpdateAsyncBase.java:
##########
@@ -84,7 +84,24 @@ protected void runTest(int queueCapacity) throws
IOException, InterruptedExcepti
final Future<?> updateTask =
executorService.submit(this::markRecordsAsCommitted);
- Assertions.assertTrue(latch.await(1, TimeUnit.MINUTES), "Failed to
generate records within 1 minute");
+ executorService.shutdown();
+
+ // Wait for both tasks to complete using Awaitility instead of only
+ // waiting for the generate task via a latch, which left a race window
+ // where the update task could still be running when verification
began.
+ await().atMost(2, TimeUnit.MINUTES)
+ .until(executorService::isTerminated);
Review Comment:
Good point. Addressed — wrapped the entire test body in a try-finally with
`executorService.shutdownNow()` + `awaitTermination(5s)` to prevent thread
leaks on failure.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]