NO-JIRA fixing eventual test race on LVQTest::testSimple

This commit is contained in:
Clebert Suconic 2024-11-21 13:57:27 -05:00
parent 20a115fcb1
commit 72dae9e88e
1 changed files with 8 additions and 0 deletions

View File

@ -78,6 +78,14 @@ public class LVQTest extends ActiveMQTestBase {
m2.putStringProperty(Message.HDR_LAST_VALUE_NAME, rh);
producer.send(m1);
producer.send(m2);
Queue lvQueue = server.locateQueue(qName1);
// delivering is asynchronous. We have to make sure that all messages were sent
Wait.assertEquals(2L, lvQueue::getMessagesAdded, 5000, 100);
// messages were replaced by the LVQ so it should have only one
Wait.assertEquals(1L, lvQueue::getMessageCount, 5000, 100);
Wait.assertEquals(1L, lvQueue::getMessagesReplaced, 5000, 100);
clientSession.start();
ClientMessage m = consumer.receive(1000);
assertNotNull(m);