Skip to content

Commit c1162bf

Browse files
gnodetclaude
andcommitted
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 to avoid mock state contamination via reset() - Increase delay gaps to 500ms/2000ms (matching the pattern in MulticastParallelStreamingTest) so completion ordering is deterministic even on busy systems - Replace assertMockEndpointsSatisfied() with Awaitility await().untilAsserted() per project testing guidelines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 56c0fb6 commit c1162bf

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

core/camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelStreamingTest.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
*/
1717
package org.apache.camel.processor;
1818

19+
import java.util.concurrent.TimeUnit;
20+
1921
import org.apache.camel.ContextTestSupport;
2022
import org.apache.camel.builder.RouteBuilder;
2123
import org.apache.camel.component.mock.MockEndpoint;
2224
import org.junit.jupiter.api.Test;
2325

26+
import static org.awaitility.Awaitility.await;
27+
2428
public class RecipientListParallelStreamingTest extends ContextTestSupport {
2529

2630
@Test
@@ -30,14 +34,17 @@ public void testRecipientListParallel() throws Exception {
3034

3135
template.sendBodyAndHeader("direct:start", "Hello World", "foo", "direct:a,direct:b,direct:c");
3236

33-
assertMockEndpointsSatisfied();
37+
await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> mock.assertIsSatisfied());
38+
}
3439

35-
mock.reset();
40+
@Test
41+
public void testRecipientListParallelStreaming() throws Exception {
42+
MockEndpoint mock = getMockEndpoint("mock:result");
3643
mock.expectedBodiesReceived("b");
3744

3845
template.sendBodyAndHeader("direct:streaming", "Hello World", "foo", "direct:a,direct:b,direct:c");
3946

40-
assertMockEndpointsSatisfied();
47+
await().atMost(10, TimeUnit.SECONDS).untilAsserted(() -> mock.assertIsSatisfied());
4148
}
4249

4350
@Override
@@ -49,8 +56,8 @@ public void configure() {
4956

5057
from("direct:streaming").recipientList(header("foo")).parallelProcessing().streaming().to("mock:result");
5158

52-
from("direct:a").delay(100).syncDelayed().transform(constant("a"));
53-
from("direct:b").delay(500).syncDelayed().transform(constant("b"));
59+
from("direct:a").delay(500).syncDelayed().transform(constant("a"));
60+
from("direct:b").delay(2000).syncDelayed().transform(constant("b"));
5461
from("direct:c").transform(constant("c"));
5562
}
5663
};

0 commit comments

Comments
 (0)