This is an automated email from the ASF dual-hosted git repository.
apupier 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 24d1ac73bbd2 Reduce flakiness of SjmsConnectionRecoveryTest
24d1ac73bbd2 is described below
commit 24d1ac73bbd214809fd2cc814e979c51005f4164
Author: Aurélien Pupier <[email protected]>
AuthorDate: Mon Jul 27 16:16:30 2026 +0200
Reduce flakiness of SjmsConnectionRecoveryTest
The Phase 5 untilAsserted block calls template.sendBody() on every retry
iteration. Each call successfully enqueues a message on the broker. When
the consumer finally comes up, it drains all accumulated messages at
once. But mock.reset() + mock.expectedMessageCount(1) expects exactly 1
— so 2+ accumulated deliveries cause a "received N but expected 1"
assertion failure, which Awaitility keeps retrying (adding more messages
each time) until the 30-second timeout. Fix: use
mock.expectedMinimumMessageCount(1) in Phase 5, or purge the queue at
the start of each retry iteration.
Co-authored-by: IBM Bob IDE 2.0.1
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
index bfa74fe66c46..470325a90aa0 100644
---
a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
+++
b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/SjmsConnectionRecoveryTest.java
@@ -182,7 +182,7 @@ public class SjmsConnectionRecoveryTest extends
CamelTestSupport {
await().atMost(30, TimeUnit.SECONDS)
.untilAsserted(() -> {
mock.reset();
- mock.expectedMessageCount(1);
+ mock.expectedMinimumMessageCount(1);
template.sendBody(SJMS_QUEUE_NAME, "after-failure");
mock.assertIsSatisfied();
});