Copilot commented on code in PR #24417:
URL: https://github.com/apache/camel/pull/24417#discussion_r3523960470
##########
core/camel-core/src/test/java/org/apache/camel/processor/MulticastParallelStreamingTimeoutTest.java:
##########
@@ -16,28 +16,37 @@
*/
package org.apache.camel.processor;
+import java.util.concurrent.TimeUnit;
+
import org.apache.camel.AggregationStrategy;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.parallel.Isolated;
+
+import static org.awaitility.Awaitility.await;
+@Isolated("Short timeouts cause problems with parallel test execution")
@DisabledOnOs(architectures = { "s390x" },
disabledReason = "This test does not run reliably on s390x (see
CAMEL-21438)")
public class MulticastParallelStreamingTimeoutTest extends ContextTestSupport {
@Test
public void testMulticastParallelStreamingTimeout() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
- // A will timeout so we only get B and C (C is faster than B)
- mock.expectedBodiesReceived("CB");
- mock.setResultWaitTime(20000);
+ // A will timeout so we only get B and C (order may vary)
+ mock.expectedMessageCount(1);
+ mock.message(0).body().not(body().contains("A"));
+ mock.message(0).body().contains("B");
+ mock.message(0).body().contains("C");
template.sendBody("direct:start", "Hello");
- assertMockEndpointsSatisfied();
+ await().atMost(20, TimeUnit.SECONDS)
+ .untilAsserted(() -> assertMockEndpointsSatisfied());
Review Comment:
`await().atMost(20s).untilAsserted(() -> assertMockEndpointsSatisfied())`
wraps an assertion that can block up to the MockEndpoint default wait time (10s
when `resultWaitTime==0`). If the first attempt spends close to 10s and then
fails, subsequent retries can push the overall wait beyond the intended 20s,
reintroducing timing-related flakiness.
Consider using the built-in timeout overload instead (single wait with a
clear upper bound), and drop the Awaitility import for this test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]