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

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/main by this push:
     new ac047b6c8f fix flaky AMQ6133PersistJMSRedeliveryTest using 
Wait.waitFor (#1872)
ac047b6c8f is described below

commit ac047b6c8f37afb3e42c7f03323fd1d9d6deb132
Author: gurpartap3697 <[email protected]>
AuthorDate: Sun Apr 5 11:05:58 2026 +0530

    fix flaky AMQ6133PersistJMSRedeliveryTest using Wait.waitFor (#1872)
---
 .../activemq/bugs/AMQ6133PersistJMSRedeliveryTest.java  | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ6133PersistJMSRedeliveryTest.java
 
b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ6133PersistJMSRedeliveryTest.java
index 5989ca72d0..477a03e994 100644
--- 
a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ6133PersistJMSRedeliveryTest.java
+++ 
b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ6133PersistJMSRedeliveryTest.java
@@ -45,6 +45,7 @@ import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
 import org.apache.activemq.store.kahadb.MessageDatabase;
+import org.apache.activemq.util.Wait;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.TrueFileFilter;
 import org.apache.commons.io.filefilter.WildcardFileFilter;
@@ -89,11 +90,23 @@ public class AMQ6133PersistJMSRedeliveryTest {
 
         restart();
 
-        assertEquals(msgCount, getProxyToQueue(QUEUE_NAME).getQueueSize());
+        assertTrue("Queue size should match expected count: " + msgCount, 
Wait.waitFor(() -> {
+            try {
+                return getProxyToQueue(QUEUE_NAME).getQueueSize() == msgCount;
+            } catch (Exception e) {
+               return false;
+            }
+        }));
 
         restartWithRecovery(getPersistentDir());
 
-        assertEquals(msgCount, getProxyToQueue(QUEUE_NAME).getQueueSize());
+        assertTrue("Queue size should match expected count: " + msgCount, 
Wait.waitFor(() -> {
+            try {
+                return getProxyToQueue(QUEUE_NAME).getQueueSize() == msgCount;
+            } catch (Exception e) {
+                return false;
+            }
+        }));
     }
 
     @Before


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to