Skip to content

Commit

Permalink
NO-JIRA Test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Jun 1, 2024
1 parent add773e commit ae92b71
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.apache.activemq.artemis.tests.soak.SoakTestBase;
import org.apache.activemq.artemis.utils.ExecuteUtil;
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.qpid.jms.JmsConnectionFactory;
import org.fusesource.mqtt.client.BlockingConnection;
Expand All @@ -73,6 +74,8 @@
@RunWith(Parameterized.class)
public class SoakReplicatedPagingTest extends SoakTestBase {

public static int OK = 1;

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

public static final int LAG_CONSUMER_TIME = 1000;
Expand Down Expand Up @@ -224,7 +227,12 @@ public void run() {
logger.debug("Awaiting timeout...");
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);

exit(exitStatus, "Consumed " + consumed.get() + " messages");
Expand All @@ -236,7 +244,7 @@ public void run() {
}

public static void exit(int code, String message) {
System.out.println("Exit code:: " + message);
System.out.println("Exit code:: " + code + "::" + message);
System.exit(code);
}

Expand All @@ -259,7 +267,7 @@ public void testPagingReplication() throws Throwable {
if (result <= 0) {
jstack();
}
Assert.assertEquals(0, result);
Assert.assertEquals(OK, result);
}
}

Expand Down

0 comments on commit ae92b71

Please sign in to comment.