Skip to content

Commit 0bb3415

Browse files
gnodetclaude
andauthored
CAMEL-23901: Fix flaky MulticastParallelStreamingTimeoutTest (#24417)
* CAMEL-23901: Fix flaky MulticastParallelStreamingTimeoutTest Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Guillaume Nodet <gnodet@gmail.com> * CAMEL-23901: Set short resultWaitTime to avoid double-wait with Awaitility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Guillaume Nodet <gnodet@gmail.com> --------- Signed-off-by: Guillaume Nodet <gnodet@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b419473 commit 0bb3415

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

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

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

19+
import java.util.concurrent.TimeUnit;
20+
1921
import org.apache.camel.AggregationStrategy;
2022
import org.apache.camel.ContextTestSupport;
2123
import org.apache.camel.Exchange;
2224
import org.apache.camel.builder.RouteBuilder;
2325
import org.apache.camel.component.mock.MockEndpoint;
2426
import org.junit.jupiter.api.Test;
2527
import org.junit.jupiter.api.condition.DisabledOnOs;
28+
import org.junit.jupiter.api.parallel.Isolated;
29+
30+
import static org.awaitility.Awaitility.await;
2631

32+
@Isolated("Short timeouts cause problems with parallel test execution")
2733
@DisabledOnOs(architectures = { "s390x" },
2834
disabledReason = "This test does not run reliably on s390x (see CAMEL-21438)")
2935
public class MulticastParallelStreamingTimeoutTest extends ContextTestSupport {
3036

3137
@Test
3238
public void testMulticastParallelStreamingTimeout() throws Exception {
3339
MockEndpoint mock = getMockEndpoint("mock:result");
34-
// A will timeout so we only get B and C (C is faster than B)
35-
mock.expectedBodiesReceived("CB");
36-
mock.setResultWaitTime(20000);
40+
// A will timeout so we only get B and C (order may vary)
41+
mock.expectedMessageCount(1);
42+
mock.message(0).body().not(body().contains("A"));
43+
mock.message(0).body().contains("B");
44+
mock.message(0).body().contains("C");
45+
// Use a short result wait time so each Awaitility attempt checks quickly
46+
// without blocking (default 0 maps to 10s internally in MockEndpoint)
47+
mock.setResultWaitTime(100);
3748

3849
template.sendBody("direct:start", "Hello");
3950

40-
assertMockEndpointsSatisfied();
51+
await().atMost(20, TimeUnit.SECONDS)
52+
.untilAsserted(() -> assertMockEndpointsSatisfied());
4153
}
4254

4355
@Override

0 commit comments

Comments
 (0)