NO-JIRA Intermittent fixes

This commit is contained in:
Clebert Suconic 2020-04-24 10:14:26 -04:00
parent c883a73746
commit d116cb96de
2 changed files with 15 additions and 3 deletions

View File

@ -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.spi.core.security.ActiveMQSecurityManagerImpl;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.Wait; 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.RetryRule;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor; import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
@ -123,7 +122,7 @@ public class PagingTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(PagingTest.class); private static final Logger log = Logger.getLogger(PagingTest.class);
@Rule @Rule
public RetryRule retryMethod = new RetryRule(0); public RetryRule retryMethod = new RetryRule(1);
private static final Logger logger = Logger.getLogger(PagingTest.class); private static final Logger logger = Logger.getLogger(PagingTest.class);
@ -1743,7 +1742,6 @@ public class PagingTest extends ActiveMQTestBase {
} }
@RetryMethod(retries = 1)
@Test @Test
public void testInabilityToCreateDirectoryDuringPaging() throws Exception { public void testInabilityToCreateDirectoryDuringPaging() throws Exception {
// this test only applies to file-based stores // this test only applies to file-based stores

View File

@ -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.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.Wait; 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.apache.activemq.artemis.utils.collections.LinkedListIterator;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
public class LVQTest extends ActiveMQTestBase { public class LVQTest extends ActiveMQTestBase {
@Rule
public RetryRule retryRule = new RetryRule(2);
private ActiveMQServer server; private ActiveMQServer server;
private ClientSession clientSession; private ClientSession clientSession;
@ -541,6 +547,12 @@ public class LVQTest extends ActiveMQTestBase {
assertEquals(0, queue.getDeliveringCount()); 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 @Test
public void testScheduledMessages() throws Exception { public void testScheduledMessages() throws Exception {
final long DELAY_TIME = 10; 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 // allow schedules to elapse so the messages will be delivered to the queue
Wait.waitFor(() -> queue.getScheduledCount() == 0); Wait.waitFor(() -> queue.getScheduledCount() == 0);
Wait.assertEquals(MESSAGE_COUNT, queue::getMessagesAdded);
clientSession.start(); clientSession.start();
ClientMessage m = consumer.receive(5000); ClientMessage m = consumer.receive(5000);
assertNotNull(m); assertNotNull(m);