From d116cb96de66d47f95bd488801a475c02547e4d5 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Fri, 24 Apr 2020 10:14:26 -0400 Subject: [PATCH] NO-JIRA Intermittent fixes --- .../tests/integration/paging/PagingTest.java | 4 +--- .../artemis/tests/integration/server/LVQTest.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java index b093ffe71e..bbf96abc61 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java @@ -104,7 +104,6 @@ import org.apache.activemq.artemis.logs.AssertionLoggerHandler; import org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManagerImpl; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.Wait; -import org.apache.activemq.artemis.utils.RetryMethod; import org.apache.activemq.artemis.utils.RetryRule; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.jboss.logging.Logger; @@ -123,7 +122,7 @@ public class PagingTest extends ActiveMQTestBase { private static final Logger log = Logger.getLogger(PagingTest.class); @Rule - public RetryRule retryMethod = new RetryRule(0); + public RetryRule retryMethod = new RetryRule(1); private static final Logger logger = Logger.getLogger(PagingTest.class); @@ -1743,7 +1742,6 @@ public class PagingTest extends ActiveMQTestBase { } - @RetryMethod(retries = 1) @Test public void testInabilityToCreateDirectoryDuringPaging() throws Exception { // this test only applies to file-based stores diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java index 2f233a4465..d35a96b2a2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/LVQTest.java @@ -33,13 +33,19 @@ import org.apache.activemq.artemis.core.server.impl.LastValueQueue; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.Wait; +import org.apache.activemq.artemis.utils.RetryMethod; +import org.apache.activemq.artemis.utils.RetryRule; import org.apache.activemq.artemis.utils.collections.LinkedListIterator; import org.junit.Assert; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; public class LVQTest extends ActiveMQTestBase { + @Rule + public RetryRule retryRule = new RetryRule(2); + private ActiveMQServer server; private ClientSession clientSession; @@ -541,6 +547,12 @@ public class LVQTest extends ActiveMQTestBase { assertEquals(0, queue.getDeliveringCount()); } + // There's a race between the schedule message reaching the queue, + // and actually being delivered + // by the time scheduledCount == 0 the message could still be in flight to the queue on + // an executor, and that's not an issue, + // however this test may eventually fail because of that, so I'm setting a retry here + @RetryMethod(retries = 3) @Test public void testScheduledMessages() throws Exception { final long DELAY_TIME = 10; @@ -562,6 +574,8 @@ public class LVQTest extends ActiveMQTestBase { // allow schedules to elapse so the messages will be delivered to the queue Wait.waitFor(() -> queue.getScheduledCount() == 0); + Wait.assertEquals(MESSAGE_COUNT, queue::getMessagesAdded); + clientSession.start(); ClientMessage m = consumer.receive(5000); assertNotNull(m);