NO-JIRA Fixing intermittent failure on BasicXaTest

It would fail on cannot destroy queue
as the failure could be asynchronous, introducing a quick race, which is acceptable
you just need to make sure the async operation will finish before removing the queue.

Fix is to introduce a Wait.assertEquals call.
This commit is contained in:
Clebert Suconic 2019-09-06 10:28:12 -04:00
parent 07276ee09c
commit 93dcd27b39
1 changed files with 7 additions and 0 deletions

View File

@ -40,12 +40,14 @@ import org.apache.activemq.artemis.core.config.StoreConfiguration;
import org.apache.activemq.artemis.core.persistence.StorageManager;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.ra.ActiveMQRAXAResource;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.Wait;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -233,8 +235,13 @@ public class BasicXaTest extends ActiveMQTestBase {
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
Queue queueAtestQ = messagingService.locateQueue(atestq);
Assert.assertNotNull(queueAtestQ);
clientSession.getSessionFactory().getConnection().destroy();
Wait.assertEquals(0, queueAtestQ::getConsumerCount);
messagingService.destroyQueue(atestq);
messagingService.stop();