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

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

commit 9b0dfb1d113e075a67702aaff3e1407d0c1c6e1c
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Jul 16 14:21:41 2026 +0000

    CAMEL-24063: Fix flaky 
DirectProducerBlockingTest.testProducerBlocksResumeTest
    
    The test suspends a route then sends with block=true&timeout=2000.
    A background thread waits for the main thread to reach TIMED_WAITING,
    then resumes the route. Under CI load, detecting the thread state and
    resuming can take more than 2 s, causing:
    
      DirectConsumerNotAvailableException: No consumers available on
      endpoint: direct://suspended?block=true&timeout=2000
    
    Fix: increase both the background thread's Awaitility timeout (2s→10s)
    and the sendBody block timeout (2000→10000ms) so there is enough
    headroom even on loaded CI nodes.
    
    Develocity evidence: testProducerBlocksResumeTest has 8 flaky runs
    out of 716 total on main (1.1% flaky rate).
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../camel/component/direct/DirectProducerBlockingTest.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/direct/DirectProducerBlockingTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/direct/DirectProducerBlockingTest.java
index 4ad06aa15819..160777ee4ecb 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/direct/DirectProducerBlockingTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/direct/DirectProducerBlockingTest.java
@@ -85,8 +85,10 @@ public class DirectProducerBlockingTest extends 
ContextTestSupport {
             public void run() {
                 try {
                     // Wait for the main thread to enter TIMED_WAITING state
-                    // (blocked on condition in DirectComponent.getConsumer)
-                    await().atMost(2, TimeUnit.SECONDS)
+                    // (blocked on condition in DirectComponent.getConsumer).
+                    // Use a generous timeout — on slow CI the thread state
+                    // detection can take longer than 2 s.
+                    await().atMost(10, TimeUnit.SECONDS)
                             .pollInterval(10, TimeUnit.MILLISECONDS)
                             .until(() -> mainThread.getState() == 
Thread.State.TIMED_WAITING);
 
@@ -98,8 +100,10 @@ public class DirectProducerBlockingTest extends 
ContextTestSupport {
             }
         });
 
-        // This call will block until the route is resumed by the background 
thread
-        template.sendBody("direct:suspended?block=true&timeout=2000", "hello 
world");
+        // This call will block until the route is resumed by the background 
thread.
+        // Use a generous timeout so the background thread has enough headroom 
to
+        // detect the TIMED_WAITING state and resume the route even under CI 
load.
+        template.sendBody("direct:suspended?block=true&timeout=10000", "hello 
world");
 
         assertMockEndpointsSatisfied();
 

Reply via email to