This is an automated email from the ASF dual-hosted git repository.
gnodet 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 7dd0473ad12e CAMEL-23900: Fix flaky RecipientListParallelStreamingTest
7dd0473ad12e is described below
commit 7dd0473ad12edf4b8f94faa96dd4854bb402ef58
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sat Jul 4 18:39:10 2026 +0200
CAMEL-23900: Fix flaky RecipientListParallelStreamingTest
The streaming test relied on completion ordering from small delays
(100ms/500ms) that collapsed under CI thread scheduling jitter,
causing the UseLatestAggregationStrategy to pick the wrong result.
Split single test into two isolated methods, increase delay gaps to
500ms/2000ms, and replace assertMockEndpointsSatisfied() with
Awaitility await().untilAsserted() per project testing guidelines.
Closes #24415
---
.../processor/RecipientListParallelStreamingTest.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git
a/core/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelStreamingTest.java
b/core/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelStreamingTest.java
index d7d6fbf278a0..f6f4e7ca90cb 100644
---
a/core/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelStreamingTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelStreamingTest.java
@@ -16,11 +16,15 @@
*/
package org.apache.camel.processor;
+import java.util.concurrent.TimeUnit;
+
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;
+import static org.awaitility.Awaitility.await;
+
public class RecipientListParallelStreamingTest extends ContextTestSupport {
@Test
@@ -30,14 +34,17 @@ public class RecipientListParallelStreamingTest extends
ContextTestSupport {
template.sendBodyAndHeader("direct:start", "Hello World", "foo",
"direct:a,direct:b,direct:c");
- assertMockEndpointsSatisfied();
+ await().atMost(10, TimeUnit.SECONDS).untilAsserted(() ->
mock.assertIsSatisfied());
+ }
- mock.reset();
+ @Test
+ public void testRecipientListParallelStreaming() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("b");
template.sendBodyAndHeader("direct:streaming", "Hello World", "foo",
"direct:a,direct:b,direct:c");
- assertMockEndpointsSatisfied();
+ await().atMost(10, TimeUnit.SECONDS).untilAsserted(() ->
mock.assertIsSatisfied());
}
@Override
@@ -49,8 +56,8 @@ public class RecipientListParallelStreamingTest extends
ContextTestSupport {
from("direct:streaming").recipientList(header("foo")).parallelProcessing().streaming().to("mock:result");
-
from("direct:a").delay(100).syncDelayed().transform(constant("a"));
-
from("direct:b").delay(500).syncDelayed().transform(constant("b"));
+
from("direct:a").delay(500).syncDelayed().transform(constant("a"));
+
from("direct:b").delay(2000).syncDelayed().transform(constant("b"));
from("direct:c").transform(constant("c"));
}
};