NO-JIRA Test fixes

This commit is contained in:
Clebert Suconic 2019-05-16 18:26:26 -04:00
parent bb02d9664b
commit 5f481d6220
6 changed files with 29 additions and 18 deletions

View File

@ -91,6 +91,7 @@ public class LiveCrashOnBackupSyncTest extends ActiveMQTestBase {
Wait.waitFor(() -> liveServer.isStarted());
File liveLMDir = liveServer.getConfiguration().getLargeMessagesLocation();
Wait.assertTrue(() -> getAllMessageFileIds(liveLMDir).size() == 0, 5000, 100);
Set<Long> liveLM = getAllMessageFileIds(liveLMDir);
Assert.assertEquals("we really ought to delete these after delivery", 0, liveLM.size());
liveServer.stop();

View File

@ -40,7 +40,6 @@ import org.junit.Test;
/**
* A PagingFailoverTest
* <br>
* TODO: validate replication failover also
*/
public class PagingFailoverTest extends FailoverTestBase {
// Constants -----------------------------------------------------
@ -87,7 +86,7 @@ public class PagingFailoverTest extends FailoverTestBase {
}
public void internalTestPage(final boolean transacted, final boolean failBeforeConsume) throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(15);
locator.setBlockOnNonDurableSend(false).setBlockOnDurableSend(false).setReconnectAttempts(15);
sf = createSessionFactoryAndWaitForTopology(locator, 2);
session = addClientSession(sf.createSession(!transacted, !transacted, 0));
@ -96,7 +95,7 @@ public class PagingFailoverTest extends FailoverTestBase {
ClientProducer prod = session.createProducer(PagingFailoverTest.ADDRESS);
final int TOTAL_MESSAGES = 2000;
final int TOTAL_MESSAGES = 200;
for (int i = 0; i < TOTAL_MESSAGES; i++) {
if (transacted && i % 10 == 0) {
@ -138,8 +137,6 @@ public class PagingFailoverTest extends FailoverTestBase {
cons.close();
Thread.sleep(1000);
if (!failBeforeConsume) {
crash(session);
// failSession(session, latch);
@ -165,10 +162,10 @@ public class PagingFailoverTest extends FailoverTestBase {
@Test
public void testExpireMessage() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(15);
locator.setBlockOnNonDurableSend(false).setBlockOnDurableSend(false).setReconnectAttempts(15);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
session = sf.createSession(true, true, 0);
session = sf.createSession(false, false, 0);
session.createQueue(PagingFailoverTest.ADDRESS, PagingFailoverTest.ADDRESS, true);
@ -179,21 +176,24 @@ public class PagingFailoverTest extends FailoverTestBase {
for (int i = 0; i < TOTAL_MESSAGES; i++) {
ClientMessage msg = session.createMessage(true);
msg.putIntProperty(new SimpleString("key"), i);
msg.setExpiration(System.currentTimeMillis() + 1000);
msg.setExpiration(System.currentTimeMillis() + 100);
prod.send(msg);
}
session.commit();
crash(session);
session.close();
Queue queue = backupServer.getServer().locateQueue(ADDRESS);
long timeout = System.currentTimeMillis() + 60000;
long timeout = System.currentTimeMillis() + 6000;
while (timeout > System.currentTimeMillis() && queue.getPageSubscription().isPaging()) {
Thread.sleep(100);
// Simulating what would happen on expire
System.out.println("IsPaging " + queue.getPageSubscription().isPaging());
queue.expireReferences();
}

View File

@ -58,6 +58,7 @@ public class ReplicatedMultipleServerFailoverExtraBackupsTest extends Replicated
backupServers.get(3).start();
sendCrashReceive();
Wait.assertTrue(backupServers.get(0)::isActive, 5000, 10);
waitForTopology(backupServers.get(0).getServer(), liveServers.size(), 2);
sendCrashBackupReceive();
}

View File

@ -98,6 +98,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
public void testAutomaticFailover() throws Exception {
ActiveMQConnectionFactory jbcf = ActiveMQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.CF, livetc);
jbcf.setReconnectAttempts(-1);
jbcf.setRetryInterval(10);
jbcf.setBlockOnDurableSend(true);
jbcf.setBlockOnNonDurableSend(true);
@ -267,6 +268,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
backupConf = createBasicConfig().addAcceptorConfiguration(backupAcceptortc).addConnectorConfiguration(livetc.getName(), livetc).addConnectorConfiguration(backuptc.getName(), backuptc).setJournalType(getDefaultJournalType()).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, backupParams)).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreSlavePolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(backuptc.getName(), livetc.getName()));
backupConf.setConnectionTtlCheckInterval(100);
backupServer = addServer(new InVMNodeManagerServer(backupConf, nodeManager));
@ -275,6 +277,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
backupServer.start();
liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName()));
liveConf.setConnectionTtlCheckInterval(100);
liveServer = addServer(new InVMNodeManagerServer(liveConf, nodeManager));

View File

@ -539,11 +539,6 @@ public class PagingTest extends ActiveMQTestBase {
Wait.assertFalse(purgeQueue.getPageSubscription()::isPaging);
Wait.assertEquals(0, purgeQueue.getPageSubscription().getPagingStore()::getAddressSize);
purgeQueue.getPageSubscription().getPagingStore().startPaging();
Wait.assertTrue(purgeQueue.getPageSubscription()::isPaging);
consumer = session.createConsumer(jmsQueue);
for (int i = 0; i < 100; i++) {
@ -557,6 +552,8 @@ public class PagingTest extends ActiveMQTestBase {
session.commit();
Wait.assertTrue(purgeQueue.getPageSubscription()::isPaging);
connection.start();
server.getStorageManager().getMessageJournal().scheduleCompactAndBlock(50000);

View File

@ -25,11 +25,13 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.junit.Wait;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -50,7 +52,7 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase {
public void testAddressQueueDeleteDelay() throws Exception {
SimpleString address = RandomUtil.randomSimpleString();
SimpleString queue = RandomUtil.randomSimpleString();
final long deleteQueuesDelay = 300;
final long deleteQueuesDelay = 150;
final long deleteAddressesDelay = 500;
AddressSettings addressSettings = new AddressSettings().setAutoDeleteQueuesDelay(deleteQueuesDelay).setAutoDeleteAddressesDelay(deleteAddressesDelay);
@ -72,15 +74,22 @@ public class AddressQueueDeleteDelayTest extends ActiveMQTestBase {
consumer.close();
long start = System.currentTimeMillis();
assertTrue(Wait.waitFor(() -> server.locateQueue(queue) == null, DURATION_MILLIS, SLEEP_MILLIS));
final AddressInfo info = server.getAddressInfo(address);
Wait.assertTrue(() -> server.locateQueue(queue) == null, DURATION_MILLIS, 10);
Assert.assertNotNull(info);
Wait.assertTrue(() -> info.getBindingRemovedTimestamp() > 0, 5000, 10);
long elapsedTime = System.currentTimeMillis() - start;
IntegrationTestLogger.LOGGER.info("Elapsed time to delete queue: " + elapsedTime);
assertTrue(elapsedTime >= (deleteQueuesDelay));
start = System.currentTimeMillis();
start = info.getBindingRemovedTimestamp();
assertTrue(Wait.waitFor(() -> server.getAddressInfo(address) == null, DURATION_MILLIS, SLEEP_MILLIS));
elapsedTime = System.currentTimeMillis() - start;
IntegrationTestLogger.LOGGER.info("Elapsed time to delete address: " + elapsedTime);
assertTrue(elapsedTime >= (deleteAddressesDelay));
assertTrue("ellapsedTime=" + elapsedTime + " while delay is " + deleteAddressesDelay, elapsedTime >= (deleteAddressesDelay));
}
@Test