ARTEMIS-4986 Tweaks on test: Disable load balancing and check for no messages

This commit is contained in:
Clebert Suconic 2024-08-15 18:14:20 -04:00
parent 3f5184a933
commit 583af58e43
1 changed files with 17 additions and 0 deletions

View File

@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
@ -148,6 +149,8 @@ public class RollingUpgradeTest extends RealServerTestBase {
File brokerXml = new File(serverLocation, "/etc/broker.xml");
assertTrue(FileUtil.findReplace(brokerXml, "ON_DEMAND", "OFF"));
if (live) {
boolean replacedMaster = FileUtil.findReplace(brokerXml, "</primary>", " <group-name>" + replicaGroupName + "</group-name>\n" + " <check-for-live-server>true</check-for-live-server>\n" + " <quorum-size>2</quorum-size>\n" + " </primary>");
replacedMaster |= FileUtil.findReplace(brokerXml, "</master>", " <group-name>" + replicaGroupName + "</group-name>\n" + " <check-for-live-server>true</check-for-live-server>\n" + " <quorum-size>2</quorum-size>\n" + " </master>");
@ -264,14 +267,17 @@ public class RollingUpgradeTest extends RealServerTestBase {
consumeMessage(LIVE0_URI, "AMQP");
consumeMessage(LIVE0_URI, "CORE");
consumeMessage(LIVE0_URI, "OPENWIRE");
checkNoMessages(LIVE0_URI);
consumeMessage(LIVE1_URI, "AMQP");
consumeMessage(LIVE1_URI, "CORE");
consumeMessage(LIVE1_URI, "OPENWIRE");
checkNoMessages(LIVE1_URI);
consumeMessage(LIVE2_URI, "AMQP");
consumeMessage(LIVE2_URI, "CORE");
consumeMessage(LIVE2_URI, "OPENWIRE");
checkNoMessages(LIVE2_URI);
}
@ -302,6 +308,17 @@ public class RollingUpgradeTest extends RealServerTestBase {
}
}
private void checkNoMessages(String uri) throws Exception {
ConnectionFactory cf = CFUtil.createConnectionFactory("CORE", uri);
try (Connection connection = cf.createConnection();
Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE)) {
MessageConsumer consumer = session.createConsumer(session.createQueue(QUEUE_NAME));
connection.start();
assertNull(consumer.receiveNoWait());
consumer.close();
}
}
private Pair<Process, Process> rollUpgrade(int liveID,
String liveServerToStop,
SimpleManagement liveManagement,