From 9021e0301dc64edb9e1a8d6fabdc9f8c1a4468f4 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Wed, 23 Aug 2017 10:51:31 -0400 Subject: [PATCH] NO-JIRA Fix tests that fail on loaded system Tests that can fail on loaded system due to not waiting for metrics updates. --- .../tests/integration/amqp/AmqpDescribedTypePayloadTest.java | 4 ++-- .../artemis/tests/integration/amqp/AmqpReceiverDrainTest.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java index e8c44321b8..5ee3de0574 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpDescribedTypePayloadTest.java @@ -59,7 +59,7 @@ public class AmqpDescribedTypePayloadTest extends JMSClientTestSupport { sender.close(); Queue queue = getProxyToQueue(getQueueName()); - assertEquals(1, queue.getMessageCount()); + assertTrue("Should be one message on Queue.", Wait.waitFor(() -> queue.getMessageCount() == 1)); AmqpReceiver receiver = session.createReceiver(getQueueName()); receiver.flow(1); @@ -86,7 +86,7 @@ public class AmqpDescribedTypePayloadTest extends JMSClientTestSupport { connection.close(); Queue queue = getProxyToQueue(getQueueName()); - assertEquals(1, queue.getMessageCount()); + assertTrue("Should be one message on Queue.", Wait.waitFor(() -> queue.getMessageCount() == 1)); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(getBrokerOpenWireConnectionURI()); Connection jmsConnection = factory.createConnection(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverDrainTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverDrainTest.java index edf9459126..ca2a30eb27 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverDrainTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpReceiverDrainTest.java @@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger; +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; @@ -62,7 +63,7 @@ public class AmqpReceiverDrainTest extends AmqpClientTestSupport { Queue queueView = getProxyToQueue(destinationName); - assertEquals(MSG_COUNT, queueView.getMessageCount()); + assertTrue("Messages did not get queued", Wait.waitFor(() -> queueView.getMessageCount() == MSG_COUNT)); assertEquals(0, queueView.getDeliveringCount()); receiver.drain(MSG_COUNT);