From bcccded6e333441767adad64cea3f0eecb942686 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Sat, 4 Jul 2026 17:02:34 +0000 Subject: [PATCH] CAMEL-23903: Fix flaky test RouteIdTransactedIT in camel-jms Replace MockEndpoint.assertIsSatisfied(context) with Awaitility's untilAsserted() in both testRouteId() and testRouteIdFailed() to provide a generous 30-second timeout for transacted JMS message processing, which can exceed the default 10-second latch timeout under CI load on JDK 17. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Guillaume Nodet --- .../jms/integration/spring/tx/RouteIdTransactedIT.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/spring/tx/RouteIdTransactedIT.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/spring/tx/RouteIdTransactedIT.java index 114ea0a20e698..c6dbf56799a09 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/spring/tx/RouteIdTransactedIT.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/integration/spring/tx/RouteIdTransactedIT.java @@ -16,6 +16,8 @@ */ package org.apache.camel.component.jms.integration.spring.tx; +import java.util.concurrent.TimeUnit; + import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.jms.integration.spring.AbstractSpringJMSITSupport; import org.apache.camel.component.mock.MockEndpoint; @@ -27,6 +29,7 @@ import org.junit.jupiter.api.TestMethodOrder; import org.springframework.context.support.ClassPathXmlApplicationContext; +import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; @Tags({ @Tag("not-parallel"), @Tag("spring"), @Tag("tx") }) @@ -47,7 +50,8 @@ public void testRouteId() throws Exception { template.sendBody("activemq:queue:RouteIdTransactedTest", "Hello World"); - MockEndpoint.assertIsSatisfied(context); + await().atMost(30, TimeUnit.SECONDS) + .untilAsserted(() -> MockEndpoint.assertIsSatisfied(context)); String id = context.getRouteDefinitions().get(0).getId(); assertEquals("myCoolRoute", id); @@ -61,7 +65,8 @@ public void testRouteIdFailed() throws Exception { template.sendBody("activemq:queue:RouteIdTransactedTest", "Kaboom"); - MockEndpoint.assertIsSatisfied(context); + await().atMost(30, TimeUnit.SECONDS) + .untilAsserted(() -> MockEndpoint.assertIsSatisfied(context)); String id = context.getRouteDefinitions().get(0).getId(); assertEquals("myCoolRoute", id);