NO-JIRA Test improvements

This commit is contained in:
Clebert Suconic 2024-05-31 21:59:28 -04:00
parent add773e0fd
commit ae92b714e3
1 changed files with 11 additions and 3 deletions

View File

@ -56,6 +56,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.tests.soak.SoakTestBase; import org.apache.activemq.artemis.tests.soak.SoakTestBase;
import org.apache.activemq.artemis.utils.ExecuteUtil; import org.apache.activemq.artemis.utils.ExecuteUtil;
import org.apache.activemq.artemis.utils.SpawnedVMSupport; import org.apache.activemq.artemis.utils.SpawnedVMSupport;
import org.apache.activemq.artemis.utils.Wait;
import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; import org.apache.activemq.artemis.utils.cli.helper.HelperCreate;
import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsConnectionFactory;
import org.fusesource.mqtt.client.BlockingConnection; import org.fusesource.mqtt.client.BlockingConnection;
@ -73,6 +74,8 @@ import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class SoakReplicatedPagingTest extends SoakTestBase { public class SoakReplicatedPagingTest extends SoakTestBase {
public static int OK = 1;
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final int LAG_CONSUMER_TIME = 1000; public static final int LAG_CONSUMER_TIME = 1000;
@ -224,7 +227,12 @@ public class SoakReplicatedPagingTest extends SoakTestBase {
logger.debug("Awaiting timeout..."); logger.debug("Awaiting timeout...");
Thread.sleep(time); Thread.sleep(time);
int exitStatus = consumed.get() > 0 ? 1 : -3; if (consumed.get() == 0) {
System.out.println("Retrying to wait consumers...");
Wait.assertTrue(() -> consumed.get() > 0, 15_000, 100);
}
int exitStatus = consumed.get() > 0 ? OK : -3;
logger.debug("Exiting with the status: {}", exitStatus); logger.debug("Exiting with the status: {}", exitStatus);
exit(exitStatus, "Consumed " + consumed.get() + " messages"); exit(exitStatus, "Consumed " + consumed.get() + " messages");
@ -236,7 +244,7 @@ public class SoakReplicatedPagingTest extends SoakTestBase {
} }
public static void exit(int code, String message) { public static void exit(int code, String message) {
System.out.println("Exit code:: " + message); System.out.println("Exit code:: " + code + "::" + message);
System.exit(code); System.exit(code);
} }
@ -259,7 +267,7 @@ public class SoakReplicatedPagingTest extends SoakTestBase {
if (result <= 0) { if (result <= 0) {
jstack(); jstack();
} }
Assert.assertEquals(0, result); Assert.assertEquals(OK, result);
} }
} }