You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2026/03/10 20:57:41 UTC

(camel) 01/01: CAMEL-21917: Fix flaky Artemis-based JMS tests

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch fix/jms-security-test-jdk25
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a22bfb197ddd9f22cdc0cdebb16e91fef73b11b9
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Tue Mar 10 21:57:27 2026 +0100

    CAMEL-21917: Fix flaky Artemis-based JMS tests
    
    - Set maxDeliveryAttempts(1) on ArtemisVMInfraService address settings
      so messages go to DLQ after the first rollback instead of after 10
      redeliveries (Artemis default), avoiding timeout issues in DLQ tests
    - Check waitForActivation() return value and throw if broker fails to
      activate within 20 seconds, instead of silently proceeding with a
      broken broker
    
    Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
 .../test/infra/artemis/services/AbstractArtemisEmbeddedService.java  | 5 ++++-
 .../camel/test/infra/artemis/services/ArtemisVMInfraService.java     | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
index 41bf9b4b0f88..ee618443736f 100644
--- a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
+++ b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/AbstractArtemisEmbeddedService.java
@@ -171,7 +171,10 @@ public abstract class AbstractArtemisEmbeddedService implements ArtemisInfraServ
 
                 embeddedBrokerService.start();
 
-                embeddedBrokerService.getActiveMQServer().waitForActivation(20, TimeUnit.SECONDS);
+                if (!embeddedBrokerService.getActiveMQServer().waitForActivation(20, TimeUnit.SECONDS)) {
+                    throw new ArtemisRunException(
+                            new RuntimeException("Artemis broker did not activate within 20 seconds"));
+                }
             }
         } catch (Exception e) {
             LOG.warn("Unable to start embedded Artemis broker: {}", e.getMessage(), e);
diff --git a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisVMInfraService.java b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisVMInfraService.java
index d28631ba4ffd..2de7ac0664fc 100644
--- a/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisVMInfraService.java
+++ b/test-infra/camel-test-infra-artemis/src/main/java/org/apache/camel/test/infra/artemis/services/ArtemisVMInfraService.java
@@ -72,7 +72,8 @@ public class ArtemisVMInfraService extends AbstractArtemisEmbeddedService {
                         .setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL)
                         .setAutoDeleteQueues(false)
                         .setDeadLetterAddress(SimpleString.of("DLQ"))
-                        .setExpiryAddress(SimpleString.of("ExpiryQueue")));
+                        .setExpiryAddress(SimpleString.of("ExpiryQueue"))
+                        .setMaxDeliveryAttempts(1));
 
         return configuration;
     }