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 6d3321999c [#] Fix flaky test:
ActiveDurableSubscriptionBrowseExpireTest.java (#1986)
6d3321999c is described below
commit 6d3321999c035753186659cea7e8ddc9596eede7
Author: Matt Pavlovich <[email protected]>
AuthorDate: Thu May 21 22:48:16 2026 -0500
[#] Fix flaky test: ActiveDurableSubscriptionBrowseExpireTest.java (#1986)
---
.../usecases/ActiveDurableSubscriptionBrowseExpireTest.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git
a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ActiveDurableSubscriptionBrowseExpireTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ActiveDurableSubscriptionBrowseExpireTest.java
index 3422ceaeb6..53c1f0d8f3 100644
---
a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ActiveDurableSubscriptionBrowseExpireTest.java
+++
b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ActiveDurableSubscriptionBrowseExpireTest.java
@@ -18,6 +18,7 @@ package org.apache.activemq.usecases;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Arrays;
@@ -40,6 +41,7 @@ import org.apache.activemq.store.PersistenceAdapter;
import org.apache.activemq.store.TopicMessageStore;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.command.MessageId;
+import org.apache.activemq.util.Wait;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -144,8 +146,13 @@ public class ActiveDurableSubscriptionBrowseExpireTest
extends DurableSubscripti
// browse (should | should not) expire the messages on the destination
if expiration is (enabled | not enabled)
data = sub.browse();
assertNotNull(data);
- assertEquals(enableExpiration ? messagesToExpire.size() : 0,
dest.getDestinationStatistics().getExpired().getCount());
-
+
+ if (enableExpiration) {
+ assertTrue(Wait.waitFor(() ->
dest.getDestinationStatistics().getExpired().getCount() ==
messagesToExpire.size(), 5_000, 100));
+ } else {
+ assertEquals(0L,
dest.getDestinationStatistics().getExpired().getCount());
+ }
+
session.close();
con.close();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact