ARTEMIS-5035 Change some tests to use a random choice for protocol

This commit is contained in:
Clebert Suconic 2024-09-05 14:13:12 -04:00 committed by clebertsuconic
parent 8b265f4625
commit daba842984
6 changed files with 13 additions and 51 deletions

View File

@ -229,13 +229,12 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase {
public ActiveMQTestBase() { public ActiveMQTestBase() {
} }
protected static String randomProtocol() { protected static String randomProtocol() {
String[] protocols = {"AMQP", "OPENWIRE", "CORE"}; String[] protocols = {"AMQP", "OPENWIRE", "CORE"};
String protocol = protocols[org.apache.activemq.artemis.tests.util.RandomUtil.randomPositiveInt() % 3];
return protocols[org.apache.activemq.artemis.tests.util.RandomUtil.randomPositiveInt() % 3]; logger.info("Selecting {} protocol", protocol);
return protocol;
} }
protected <T> T serialClone(Object object) throws Exception { protected <T> T serialClone(Object object) throws Exception {
logger.debug("object::{}", object); logger.debug("object::{}", object);
ByteArrayOutputStream bout = new ByteArrayOutputStream(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
@ -247,7 +246,6 @@ public abstract class ActiveMQTestBase extends ArtemisTestCase {
return (T) obinp.readObject(); return (T) obinp.readObject();
} }
@AfterEach @AfterEach
public void tearDown() throws Exception { public void tearDown() throws Exception {
try { try {

View File

@ -155,13 +155,8 @@ public class IdempotentACKTest extends SoakTestBase {
@Test @Test
public void testAMQP() throws Exception { public void testRandomProtocol() throws Exception {
testACKs("AMQP"); testACKs(randomProtocol());
}
@Test
public void testCORE() throws Exception {
testACKs("CORE");
} }
private void testACKs(final String protocol) throws Exception { private void testACKs(final String protocol) throws Exception {

View File

@ -145,15 +145,10 @@ public class InterruptedLargeMessageTest extends SoakTestBase {
@Test @Test
@Timeout(240) @Timeout(240)
public void testAMQP() throws Exception { public void testRandomProtocol() throws Exception {
testInterrupt("AMQP"); testInterrupt(randomProtocol());
} }
@Test
@Timeout(240)
public void testCORE() throws Exception {
testInterrupt("CORE");
}
private void preCreateInternalQueues(String serverLocation) throws Exception { private void preCreateInternalQueues(String serverLocation) throws Exception {
Configuration configuration = createDefaultConfig(0, false); Configuration configuration = createDefaultConfig(0, false);

View File

@ -123,19 +123,8 @@ public class PagedSNFSoakTest extends SoakTestBase {
@Test @Test
@Timeout(240) @Timeout(240)
public void testAMQP() throws Exception { public void testRandomProtocol() throws Exception {
testAccumulateAndSend("AMQP"); testAccumulateAndSend(randomProtocol());
}
@Test
@Timeout(240)
public void testCORE() throws Exception {
testAccumulateAndSend("CORE");
}
@Test
public void testOpenWire() throws Exception {
testAccumulateAndSend("OPENWIRE");
} }
private void testAccumulateAndSend(final String protocol) throws Exception { private void testAccumulateAndSend(final String protocol) throws Exception {

View File

@ -58,18 +58,8 @@ public class LargeMessageSoakTest extends ActiveMQTestBase {
} }
@Test @Test
public void testAMQP() throws Exception { public void testRandomProtocol() throws Exception {
testSendReceive("AMQP"); testSendReceive(randomProtocol());
}
@Test
public void testCORE() throws Exception {
testSendReceive("CORE");
}
@Test
public void testOpenWire() throws Exception {
testSendReceive("OPENWIRE");
} }
public void testSendReceive(String protocol) throws Exception { public void testSendReceive(String protocol) throws Exception {

View File

@ -124,13 +124,8 @@ public class M_and_M_FactoryTest extends SoakTestBase {
@Test @Test
public void testM_and_M_AMQP() throws Exception { public void testM_and_M_RandomProtocol() throws Exception {
test_M_and_M_Sorting( "AMQP", 2000, 2, 2, 500); test_M_and_M_Sorting(randomProtocol(), 2000, 2, 2, 500);
}
@Test
public void testM_and_M_CORE() throws Exception {
test_M_and_M_Sorting( "CORE", 2000, 2, 2, 500);
} }
public void test_M_and_M_Sorting(String protocol, int batchSize, int restarts, int clientRuns, int killClientEveryX) throws Exception { public void test_M_and_M_Sorting(String protocol, int batchSize, int restarts, int clientRuns, int killClientEveryX) throws Exception {