This is an automated email from the ASF dual-hosted git repository.
davsclaus 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 61cc3a13bd20 CAMEL-23905: Fix flaky LRAFailuresIT
61cc3a13bd20 is described below
commit 61cc3a13bd20ea36cd4a6c37f20050b2ab4be39c
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Jul 8 07:08:04 2026 +0200
CAMEL-23905: Fix flaky LRAFailuresIT
The LRAFailuresIT test was 97% flaky because it relies on the Narayana
LRA coordinator retrying failed compensation/completion callbacks. The
coordinator's default recovery period is 120s, but the test only waited
20s. Fix: configure the LRA coordinator container with shortened recovery
periods (2s/1s) via JAVA_TOOL_OPTIONS, increase Awaitility timeouts as
safety margin, and remove a redundant assertEquals that could race.
Closes #24470
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../java/org/apache/camel/service/lra/AbstractLRATestSupport.java | 6 +++---
.../src/test/java/org/apache/camel/service/lra/LRAFailuresIT.java | 4 ++--
.../lra/services/MicroprofileLRALocalContainerInfraService.java | 6 ++++++
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git
a/components/camel-lra/src/test/java/org/apache/camel/service/lra/AbstractLRATestSupport.java
b/components/camel-lra/src/test/java/org/apache/camel/service/lra/AbstractLRATestSupport.java
index fa7604767b88..3bc05e5cd341 100644
---
a/components/camel-lra/src/test/java/org/apache/camel/service/lra/AbstractLRATestSupport.java
+++
b/components/camel-lra/src/test/java/org/apache/camel/service/lra/AbstractLRATestSupport.java
@@ -37,7 +37,6 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.equalTo;
-import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Base class for LRA based tests.
@@ -59,8 +58,9 @@ public abstract class AbstractLRATestSupport extends
CamelTestSupport {
@AfterEach
public void checkActiveLRAs() throws IOException, InterruptedException {
- await().atMost(2, SECONDS).until(() -> getNumberOfActiveLRAs(),
equalTo(activeLRAs));
- assertEquals(activeLRAs, getNumberOfActiveLRAs(), "Some LRA have been
left pending");
+ await().atMost(20, SECONDS)
+ .alias("Some LRA have been left pending")
+ .until(() -> getNumberOfActiveLRAs(), equalTo(activeLRAs));
}
@Override
diff --git
a/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRAFailuresIT.java
b/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRAFailuresIT.java
index 5d4fb74f489e..5a898103f6ba 100644
---
a/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRAFailuresIT.java
+++
b/components/camel-lra/src/test/java/org/apache/camel/service/lra/LRAFailuresIT.java
@@ -40,7 +40,7 @@ public class LRAFailuresIT extends AbstractLRATestSupport {
TestSupport.sendBody(template, "direct:saga-compensate", "hello");
- await().atMost(20, TimeUnit.SECONDS)
+ await().atMost(60, TimeUnit.SECONDS)
.until(() -> compensate.getReceivedCounter() >= 1);
compensate.assertIsSatisfied();
}
@@ -57,7 +57,7 @@ public class LRAFailuresIT extends AbstractLRATestSupport {
TestSupport.sendBody(template, "direct:saga-complete", "hello");
- await().atMost(20, TimeUnit.SECONDS)
+ await().atMost(60, TimeUnit.SECONDS)
.until(() -> complete.getReceivedCounter() >= 1
&& end.getReceivedCounter() >= 1);
complete.assertIsSatisfied();
diff --git
a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
index c371e3bc1b63..03cd8520eb17 100644
---
a/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
+++
b/test-infra/camel-test-infra-microprofile-lra/src/main/java/org/apache/camel/test/infra/microprofile/lra/services/MicroprofileLRALocalContainerInfraService.java
@@ -64,6 +64,12 @@ public class MicroprofileLRALocalContainerInfraService
super(DockerImageName.parse(imageName));
withNetworkAliases(networkAlias)
+ // Shorten the Narayana recovery period so that failed
LRA
+ // participant callbacks are retried quickly in tests
+ // (default: periodicRecoveryPeriod=120s,
recoveryBackoffPeriod=10s).
+ .withEnv("JAVA_TOOL_OPTIONS",
+
"-Dcom.arjuna.ats.arjuna.recovery.periodicRecoveryPeriod=2 "
+ +
"-Dcom.arjuna.ats.arjuna.recovery.recoveryBackoffPeriod=1")
.waitingFor(Wait.forListeningPort())
.waitingFor(Wait.forLogMessage(".*lra-coordinator-quarkus.*Listening on.*", 1));