NO-JIRA Retry test on intermittent failure

This commit is contained in:
Clebert Suconic 2020-04-23 12:51:33 -04:00
parent 7a0b0fd8a6
commit e8d23f3144
14 changed files with 93 additions and 64 deletions

View File

@ -39,6 +39,8 @@ import org.apache.activemq.artemis.core.server.impl.AddressInfo;
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.Wait;
import org.apache.activemq.artemis.utils.RetryRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -46,6 +48,9 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class JMSNonDestructiveTest extends JMSClientTestSupport {
@Rule
public RetryRule retryRule = new RetryRule(2);
private static final String NON_DESTRUCTIVE_QUEUE_NAME = "NON_DESTRUCTIVE_QUEUE";
private static final String NON_DESTRUCTIVE_EXPIRY_QUEUE_NAME = "NON_DESTRUCTIVE_EXPIRY_QUEUE";
private static final String NON_DESTRUCTIVE_LVQ_QUEUE_NAME = "NON_DESTRUCTIVE_LVQ_QUEUE";

View File

@ -38,13 +38,14 @@ import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequen
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.Wait;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class AlignedJournalImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(AlignedJournalImplTest.class);
// Constants -----------------------------------------------------
private static final LoaderCallback dummyLoader = new LoaderCallback() {
@ -532,7 +533,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase {
journalImpl.debugWait();
System.out.println("Files = " + factory.listFiles("tt"));
log.debug("Files = " + factory.listFiles("tt"));
SequentialFile file = factory.createSequentialFile("tt-1.tt");
@ -1332,7 +1333,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase {
public void failedTransaction(final long transactionID,
final List<RecordInfo> records,
final List<RecordInfo> recordsToDelete) {
System.out.println("records.length = " + records.size());
log.debug("records.length = " + records.size());
incompleteTransactions.add(transactionID);
}

View File

@ -48,7 +48,7 @@ import org.junit.Before;
public abstract class JournalImplTestBase extends ActiveMQTestBase {
private static final Logger logger = Logger.getLogger(JournalImplTestBase.class);
private static final Logger log = Logger.getLogger(JournalImplTestBase.class);
protected List<RecordInfo> records = new LinkedList<>();
@ -223,7 +223,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
* @throws Exception
*/
protected void exportImportJournal() throws Exception {
System.out.println("Exporting to " + getTestDir() + "/output.log");
log.debug("Exporting to " + getTestDir() + "/output.log");
EncodeJournal.exportJournal(getTestDir(), this.filePrefix, this.fileExtension, this.minFiles, this.fileSize, getTestDir() + "/output.log");
@ -236,12 +236,12 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
}
};
System.out.println("file = " + dir);
log.debug("file = " + dir);
File[] files = dir.listFiles(fnf);
for (File file : files) {
System.out.println("Deleting " + file);
log.debug("Deleting " + file);
file.delete();
}
@ -643,7 +643,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
expectedSet.removeAll(actualSet);
for (RecordInfo info : expectedSet) {
logger.warn("The following record is missing:: " + info);
log.warn("The following record is missing:: " + info);
}
Assert.assertEquals("There are duplicates on the actual list", actualSet.size(), actualSet.size());
@ -659,29 +659,29 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase {
HashSet<RecordInfo> hashExpected = new HashSet<>();
hashExpected.addAll(expected);
System.out.println("#Summary **********************************************************************************************************************");
log.debug("#Summary **********************************************************************************************************************");
for (RecordInfo r : hashActual) {
if (!hashExpected.contains(r)) {
System.out.println("Record " + r + " was supposed to be removed and it exists");
log.debug("Record " + r + " was supposed to be removed and it exists");
}
}
for (RecordInfo r : hashExpected) {
if (!hashActual.contains(r)) {
System.out.println("Record " + r + " was not found on actual list");
log.debug("Record " + r + " was not found on actual list");
}
}
System.out.println("#expected **********************************************************************************************************************");
log.debug("#expected **********************************************************************************************************************");
for (RecordInfo recordInfo : expected) {
System.out.println("Record::" + recordInfo);
log.debug("Record::" + recordInfo);
}
System.out.println("#actual ************************************************************************************************************************");
log.debug("#actual ************************************************************************************************************************");
for (RecordInfo recordInfo : actual) {
System.out.println("Record::" + recordInfo);
log.debug("Record::" + recordInfo);
}
System.out.println("#records ***********************************************************************************************************************");
log.debug("#records ***********************************************************************************************************************");
try {
describeJournal(journal.getFileFactory(), (JournalImpl) journal, journal.getFileFactory().getDirectory(), System.out);

View File

@ -33,12 +33,15 @@ import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
import org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public abstract class JournalImplTestUnit extends JournalImplTestBase {
private static final Logger log = Logger.getLogger(JournalImplTestUnit.class);
@Override
@After
public void tearDown() throws Exception {
@ -677,7 +680,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
int addRecordsPerFile = calculateRecordsPerFile(10 * 1024, journal.getAlignment(), JournalImpl.SIZE_ADD_RECORD + 1 + recordLength);
System.out.println(JournalImpl.SIZE_ADD_RECORD + 1 + recordLength);
log.debug(JournalImpl.SIZE_ADD_RECORD + 1 + recordLength);
// Fills exactly 10 files
int initialNumberOfAddRecords = addRecordsPerFile * 10;
@ -1013,7 +1016,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
journal.debugWait();
System.out.println("journal tmp :" + journal.debug());
log.debug("journal tmp :" + journal.debug());
List<String> files2 = fileFactory.listFiles(fileExtension);
@ -1030,7 +1033,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
journal.debugWait();
System.out.println("journal tmp2 :" + journal.debug());
log.debug("journal tmp2 :" + journal.debug());
List<String> files3 = fileFactory.listFiles(fileExtension);
@ -1085,7 +1088,7 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
journal.checkReclaimStatus();
System.out.println("journal:" + journal.debug());
log.debug("journal:" + journal.debug());
stopJournal(false);
createJournal();
@ -2983,18 +2986,18 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
* Enable System.outs again if test fails and needs to be debugged
*/
// System.out.println("Before stop ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("Before stop ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
stopJournal();
createJournal();
startJournal();
loadAndCheck();
// System.out.println("After start ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("After start ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
journal.forceMoveNextFile();
@ -3002,49 +3005,49 @@ public abstract class JournalImplTestUnit extends JournalImplTestBase {
delete(i);
}
// System.out.println("After delete ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("After delete ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
for (int i = 100; i < 200; i++) {
updateTx(transactionID, i);
}
// System.out.println("After updatetx ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("After updatetx ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
journal.forceMoveNextFile();
commit(transactionID++);
// System.out.println("After commit ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("After commit ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
for (int i = 100; i < 200; i++) {
updateTx(transactionID, i);
deleteTx(transactionID, i);
}
// System.out.println("After delete ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("After delete ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
commit(transactionID++);
// System.out.println("Before reclaim/after commit ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("Before reclaim/after commit ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
stopJournal();
createJournal();
startJournal();
loadAndCheck();
// System.out.println("After reclaim ****************************");
// System.out.println(journal.debug());
// System.out.println("*****************************************");
// log.debug("After reclaim ****************************");
// log.debug(journal.debug());
// log.debug("*****************************************");
journal.forceMoveNextFile();
checkAndReclaimFiles();

View File

@ -34,11 +34,12 @@ import org.apache.activemq.artemis.core.journal.EncodingSupport;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.Env;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class TimedBufferTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(TimedBufferTest.class);
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
@ -167,7 +168,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
IOCallback callback = new IOCallback() {
@Override
public void done() {
System.out.println("done");
log.debug("done");
latchFlushed.countDown();
}
@ -388,7 +389,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
assert observer.flushesDone() == 2;
//it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!!
//while it has to be IOPS = 1/timeout
System.out.println("elapsed time: " + elapsedTime + " with timeout: " + timeout);
log.debug("elapsed time: " + elapsedTime + " with timeout: " + timeout);
final long maxExpected = timeout + deviceTime;
Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected);
} finally {
@ -429,7 +430,7 @@ public class TimedBufferTest extends ActiveMQTestBase {
assert observer.flushesDone() == 2;
//it is much more than what is expected!!if it will fail it means that the timed IOPS = 1/(timeout + blockingDeviceFlushTime)!!!!!!
//while it has to be IOPS = 1/timeout
System.out.println("elapsed time: " + elapsedTime + " with timeout: " + timeout);
log.debug("elapsed time: " + elapsedTime + " with timeout: " + timeout);
final long maxExpected = timeout + deviceTime;
Assert.assertTrue("elapsed = " + elapsedTime + " max expected = " + maxExpected, elapsedTime <= maxExpected);
} finally {

View File

@ -41,10 +41,12 @@ import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.UUID;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.Wait;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class MessageImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(MessageImplTest.class);
@Test
public void getSetAttributes() {
@ -238,7 +240,7 @@ public class MessageImplTest extends ActiveMQTestBase {
public void testMessageCopyIssue() throws Exception {
for (long i = 0; i < 300; i++) {
if (i % 10 == 0)
System.out.println("#test " + i);
log.debug("#test " + i);
internalMessageCopy();
}
}

View File

@ -65,12 +65,14 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class PagingStoreImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(PagingStoreImplTest.class);
static {
MessagePersister.registerPersister(CoreMessagePersister.getInstance());
@ -286,7 +288,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
for (int pageNr = 0; pageNr < 2; pageNr++) {
Page page = store.depage();
System.out.println("numberOfPages = " + store.getNumberOfPages());
log.debug("numberOfPages = " + store.getNumberOfPages());
page.open();
@ -699,7 +701,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase {
page.close(false, false);
page.delete(null);
} else {
System.out.println("Depaged!!!! numerOfMessages = " + msgsRead + " of " + NUMBER_OF_MESSAGES);
log.debug("Depaged!!!! numerOfMessages = " + msgsRead + " of " + NUMBER_OF_MESSAGES);
Thread.sleep(500);
}
}

View File

@ -39,12 +39,14 @@ import org.apache.activemq.artemis.core.server.RoutingContext;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.logging.Logger;
import org.junit.Test;
/**
* This test is replicating the behaviour from https://issues.jboss.org/browse/HORNETQ-988.
*/
public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(WildcardAddressManagerUnitTest.class);
@Test
public void testUnitOnWildCardFailingScenario() throws Exception {
@ -348,7 +350,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase {
@Override
public void route(Message message, RoutingContext context) throws Exception {
System.out.println("routing message: " + message);
log.debug("routing message: " + message);
}
@Override

View File

@ -55,12 +55,15 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.FutureLatch;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class QueueImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(QueueImplTest.class);
// The tests ----------------------------------------------------------------
private ScheduledExecutorService scheduledExecutor;
@ -222,7 +225,7 @@ public class QueueImplTest extends ActiveMQTestBase {
float rate = queue.getRate();
Assert.assertTrue(rate <= 10.0f);
System.out.println("Rate: " + rate);
log.debug("Rate: " + rate);
}
@Test

View File

@ -22,6 +22,7 @@ import java.util.HashSet;
import org.apache.activemq.artemis.tests.util.SpawnedVMCheck;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.apache.activemq.artemis.utils.SpawnedVMSupport;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@ -30,6 +31,7 @@ import org.junit.Test;
* This test will start many parallel VMs, to make sure each VM would generate a good distribution of random numbers
*/
public class RandomUtilDistributionTest {
private static final Logger log = Logger.getLogger(RandomUtilDistributionTest.class);
@Rule
public SpawnedVMCheck check = new SpawnedVMCheck();
@ -67,7 +69,7 @@ public class RandomUtilDistributionTest {
// Be careful removing it (make sure you know what you're doing in case you do so)
int minimumExpected = (int) ((iterations * numberOfStarts) * 0.80);
System.out.println("value=" + value + ", minimum expected = " + minimumExpected);
log.debug("value=" + value + ", minimum expected = " + minimumExpected);
Assert.assertTrue("The Random distribution is pretty bad. All tries have returned duplicated randoms. value=" + value + ", minimum expected = " + minimumExpected, value > minimumExpected);
}
@ -89,7 +91,7 @@ public class RandomUtilDistributionTest {
valueSet.add(process[i].exitValue());
}
System.out.println("Generated " + valueSet.size() + " randoms out of " + numberOfTries + " tries");
log.debug("Generated " + valueSet.size() + " randoms out of " + numberOfTries + " tries");
return valueSet.size();

View File

@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -39,6 +40,7 @@ import org.xml.sax.InputSource;
* add a description for each new property added and try and put it in the config some where appropriate.
*/
public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(ActiveMQResourceAdapterConfigTest.class);
private static String config = "" +
"<config-property>\n" +
@ -474,7 +476,7 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase {
newConfig.append(" \" <config-property-value></config-property-value>\" + \n");
newConfig.append(" \" </config-property>\" + \n");
}
System.out.println(newConfig);
log.debug(newConfig);
fail("methods not shown please see previous and add");
}
}

View File

@ -20,21 +20,23 @@ import org.apache.activemq.artemis.core.message.impl.CoreMessage;
import org.apache.activemq.artemis.core.server.impl.MessageReferenceImpl;
import org.apache.activemq.artemis.tests.unit.UnitTestLogger;
import org.apache.activemq.artemis.utils.MemorySize;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class MemorySizeTest extends Assert {
private static final Logger log = Logger.getLogger(MemorySizeTest.class);
@Test
public void testObjectSizes() throws Exception {
UnitTestLogger.LOGGER.info("Server message size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() {
log.info("Server message size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() {
@Override
public Object createObject() {
return new CoreMessage(1, 1000);
}
}));
UnitTestLogger.LOGGER.info("Message reference size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() {
log.info("Message reference size is " + MemorySize.calculateSize(new MemorySize.ObjectFactory() {
@Override
public Object createObject() {
return new MessageReferenceImpl();

View File

@ -44,10 +44,13 @@ import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClas
import org.apache.activemq.artemis.tests.unit.util.deserialization.pkg1.TestClass2;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ObjectInputStreamWithClassLoader;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(ObjectInputStreamWithClassLoaderTest.class);
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
@ -506,7 +509,7 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase {
try {
Object deserializedObj = ois.readObject();
System.out.println("Deserialized Object " + deserializedObj);
log.debug("Deserialized Object " + deserializedObj);
myAssertNotSame(originalProxy, deserializedObj);
myAssertNotSame(originalProxy.getClass(), deserializedObj.getClass());

View File

@ -18,10 +18,11 @@ package org.apache.activemq.artemis.tests.unit.util;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.SoftValueLongObjectHashMap;
import org.jboss.logging.Logger;
import org.junit.Test;
public class SoftValueMapTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(SoftValueMapTest.class);
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
@ -50,9 +51,9 @@ public class SoftValueMapTest extends ActiveMQTestBase {
assertTrue(softCache.size() < MAX_ELEMENTS);
System.out.println("SoftCache.size " + softCache.size());
log.debug("SoftCache.size " + softCache.size());
System.out.println("Soft cache has " + softCache.size() + " elements");
log.debug("Soft cache has " + softCache.size() + " elements");
}
@Test
@ -88,9 +89,9 @@ public class SoftValueMapTest extends ActiveMQTestBase {
// this is the next one, so it should go
assertNull(softCache.get(101L));
System.out.println("SoftCache.size " + softCache.size());
log.debug("SoftCache.size " + softCache.size());
System.out.println("Soft cache has " + softCache.size() + " elements");
log.debug("Soft cache has " + softCache.size() + " elements");
}
@Test