Skip to content

Commit 9b0dfb1

Browse files
gnodetclaude
authored andcommitted
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 <noreply@anthropic.com>
1 parent 1c6f6dc commit 9b0dfb1

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

core/camel-core/src/test/java/org/apache/camel/component/direct/DirectProducerBlockingTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ public void testProducerBlocksResumeTest() throws Exception {
8585
public void run() {
8686
try {
8787
// Wait for the main thread to enter TIMED_WAITING state
88-
// (blocked on condition in DirectComponent.getConsumer)
89-
await().atMost(2, TimeUnit.SECONDS)
88+
// (blocked on condition in DirectComponent.getConsumer).
89+
// Use a generous timeout — on slow CI the thread state
90+
// detection can take longer than 2 s.
91+
await().atMost(10, TimeUnit.SECONDS)
9092
.pollInterval(10, TimeUnit.MILLISECONDS)
9193
.until(() -> mainThread.getState() == Thread.State.TIMED_WAITING);
9294

@@ -98,8 +100,10 @@ public void run() {
98100
}
99101
});
100102

101-
// This call will block until the route is resumed by the background thread
102-
template.sendBody("direct:suspended?block=true&timeout=2000", "hello world");
103+
// This call will block until the route is resumed by the background thread.
104+
// Use a generous timeout so the background thread has enough headroom to
105+
// detect the TIMED_WAITING state and resume the route even under CI load.
106+
template.sendBody("direct:suspended?block=true&timeout=10000", "hello world");
103107

104108
assertMockEndpointsSatisfied();
105109

0 commit comments

Comments
 (0)