NO-JIRA Intermittent test failure due to Wait.assertEquals

This commit is contained in:
Clebert Suconic 2020-12-21 09:38:40 -05:00
parent 6b7d963f45
commit 9f59006226
4 changed files with 7 additions and 10 deletions

View File

@ -19,12 +19,12 @@ package org.apache.activemq.artemis.tests.integration.amqp;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.transport.amqp.client.AmqpClient;
import org.apache.activemq.transport.amqp.client.AmqpConnection;
import org.apache.activemq.transport.amqp.client.AmqpMessage;
import org.apache.activemq.transport.amqp.client.AmqpReceiver;
import org.apache.activemq.transport.amqp.client.AmqpSession;
import org.junit.Assert;
import org.junit.Test;
/**
@ -57,12 +57,11 @@ public class AmqpDLQReceiverTest extends AmqpClientTestSupport {
receiver.close();
connection.close();
Thread.sleep(5000);
Queue queueView = getProxyToQueue(getQueueName());
instanceLog.debug("queueView.getMessageCount() = " + queueView.getMessageCount());
instanceLog.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
instanceLog.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize());
Assert.assertEquals(0, queueView.getMessageCount());
Wait.assertEquals(0, queueView::getMessageCount);
}
}

View File

@ -140,7 +140,7 @@ public class AmqpDescribedTypePayloadTest extends JMSClientTestSupport {
jmsConnection.close();
}
assertEquals(1, queue.getMessageCount());
Wait.assertEquals(1, queue::getMessageCount);
// Now lets receive it with AMQP and see that we get back what we expected.
AmqpReceiver receiver = session.createReceiver(getQueueName());

View File

@ -407,9 +407,7 @@ public class AmqpExpiredMessageTest extends AmqpClientTestSupport {
sender.send(message);
sender.close();
Thread.sleep(50);
assertEquals(1, queueView.getMessageCount());
Wait.assertEquals(1, queueView::getMessageCount);
// Now try and get the message
AmqpReceiver receiver = session.createReceiver(getQueueName());
@ -417,7 +415,7 @@ public class AmqpExpiredMessageTest extends AmqpClientTestSupport {
AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS);
assertNotNull(received);
assertEquals(0, queueView.getMessagesExpired());
Wait.assertEquals(0, queueView::getMessagesExpired);
connection.close();
}

View File

@ -366,8 +366,8 @@ public class QueueAutoDeleteTest extends JMSTestBase {
QueueBinding queueBinding = (QueueBinding) server.getPostOffice().getBinding(SimpleString.toSimpleString(testQueueName));
assertTrue(queueBinding.getQueue().isAutoDelete());
assertEquals(1, queueBinding.getQueue().getAutoDeleteMessageCount());
assertEquals(2, queueBinding.getQueue().getMessageCount());
Wait.assertEquals(1, queueBinding.getQueue()::getAutoDeleteMessageCount);
Wait.assertEquals(2, queueBinding.getQueue()::getMessageCount);
MessageConsumer consumer = session.createConsumer(queue);
Message message = consumer.receive(5000);