This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 284a81a1b3cd chore: camel-core - fix flaky RouteStopCutOffLogTest
284a81a1b3cd is described below

commit 284a81a1b3cd5a88f014db83623ab88f456d2e35
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Oct 9 18:59:26 2026 +0200

    chore: camel-core - fix flaky RouteStopCutOffLogTest
    
    The camel-core tests run in parallel, and other error handler tests log
    through the same DefaultErrorHandler logger, so their lines ended up in
    the captured messages. Only keep the log events from the threads of the
    test's own CamelContext.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../camel/processor/errorhandler/RouteStopCutOffLogTest.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/processor/errorhandler/RouteStopCutOffLogTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/processor/errorhandler/RouteStopCutOffLogTest.java
index e3cafa9ed426..70cc9a6946b8 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/processor/errorhandler/RouteStopCutOffLogTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/processor/errorhandler/RouteStopCutOffLogTest.java
@@ -54,9 +54,15 @@ public class RouteStopCutOffLogTest extends 
ContextTestSupport {
 
     @Test
     public void theCutOffIsOneWarnLine() throws Exception {
-        ConsumingAppender.newAppender(LOGGER, "RouteStopCutOffLogTest", 
Level.DEBUG,
-                event -> messages.add(event.getLevel() + " " + 
event.getMessage().getFormattedMessage()
-                                      + (event.getThrown() != null ? " THROWN" 
: "")));
+        // the tests in this module run in parallel, and log through the same 
error handler logger:
+        // only keep the events from the threads of this CamelContext
+        String threadMarker = "(" + context.getName() + ")";
+        ConsumingAppender.newAppender(LOGGER, "RouteStopCutOffLogTest", 
Level.DEBUG, event -> {
+            if (event.getThreadName() != null && 
event.getThreadName().contains(threadMarker)) {
+                messages.add(event.getLevel() + " " + 
event.getMessage().getFormattedMessage()
+                             + (event.getThrown() != null ? " THROWN" : ""));
+            }
+        });
         context.getShutdownStrategy().setTimeout(1);
         context.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
 

Reply via email to