ARTEMIS-5173 Fixing flaky test SimpleOpenWireTest

The advisory consumer will receive all the destinations previously created.
In an eventual the connection might miss the temporary destination from another connection.
This commit is contained in:
Clebert Suconic 2024-12-09 13:13:40 -05:00
parent 65df4cfade
commit 33d2eec7f0
1 changed files with 10 additions and 0 deletions

View File

@ -76,6 +76,7 @@ import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.command.SessionInfo;
@ -822,6 +823,8 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
try {
QueueSession newQueueSession = newConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = newQueueSession.createSender(tempQueue);
// The advisory consumer is sending the notification to the client about the temporary destinations asynchronously
Wait.assertFalse(() -> newConn.isDeleted((ActiveMQDestination) tempQueue), 5000, 100);
Message msg = queueSession.createMessage();
queueSender.send(msg);
@ -835,13 +838,20 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
connection.close();
Wait.assertTrue(() -> newConn.isDeleted((ActiveMQDestination) tempQueue), 5000, 100);
boolean failed = false;
try {
Message newMsg = newQueueSession.createMessage();
queueSender.send(newMsg);
} catch (JMSException e) {
failed = true;
//ok
}
assertTrue(failed);
} finally {
newConn.close();
}