From 569a07c287ed891b105aab489585a6c7ab2efb4e Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Tue, 16 Jul 2024 21:54:40 -0400 Subject: [PATCH] ARTEMIS-4925 Allowing server reuse on a test --- .../mirror/ReplicatedBothNodesMirrorTest.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/ReplicatedBothNodesMirrorTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/ReplicatedBothNodesMirrorTest.java index 0cbb3360d1..083a393357 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/ReplicatedBothNodesMirrorTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/brokerConnection/mirror/ReplicatedBothNodesMirrorTest.java @@ -68,6 +68,8 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase { private static final boolean TRACE_LOGS = Boolean.parseBoolean(TestParameters.testProperty(TEST_NAME, "TRACE_LOGS", "false")); private static final int NUMBER_MESSAGES = TestParameters.testProperty(TEST_NAME, "NUMBER_MESSAGES", 200); + private static final boolean REUSE_SERVERS = Boolean.parseBoolean(TestParameters.testProperty(TEST_NAME, "REUSE_SERVERS", "false")); + private static final int SEND_COMMIT = TestParameters.testProperty(TEST_NAME, "SEND_COMMIT", 50); /* @@ -153,11 +155,15 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase { boolean replicated, String clusterStatic) throws Exception { File serverLocation = getFileServerLocation(serverName); + if (REUSE_SERVERS && serverLocation.exists()) { + deleteDirectory(new File(serverLocation, "data")); + return; + } deleteDirectory(serverLocation); HelperCreate cliCreateServer = new HelperCreate(); cliCreateServer.setAllowAnonymous(true).setArtemisInstance(serverLocation); - cliCreateServer.setNoWeb(false); + cliCreateServer.setNoWeb(true); cliCreateServer.setArgs("--no-stomp-acceptor", "--no-hornetq-acceptor", "--no-mqtt-acceptor", "--no-amqp-acceptor", "--max-hops", "1", "--name", DC1_NODE); cliCreateServer.addArgs("--queues", QUEUE_NAME); cliCreateServer.setPortOffset(porOffset); @@ -207,12 +213,16 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase { private static void createMirroredBackupServer(String serverName, int porOffset, String clusterStatic, String mirrorURI) throws Exception { File serverLocation = getFileServerLocation(serverName); + if (REUSE_SERVERS && serverLocation.exists()) { + deleteDirectory(new File(serverLocation, "data")); + return; + } deleteDirectory(serverLocation); HelperCreate cliCreateServer = new HelperCreate(); cliCreateServer.setAllowAnonymous(true).setArtemisInstance(serverLocation); cliCreateServer.setMessageLoadBalancing("ON_DEMAND"); - cliCreateServer.setNoWeb(false); + cliCreateServer.setNoWeb(true); cliCreateServer.setArgs("--no-stomp-acceptor", "--no-hornetq-acceptor", "--no-mqtt-acceptor", "--no-amqp-acceptor", "--max-hops", "1", "--name", DC1_NODE); cliCreateServer.setPortOffset(porOffset); cliCreateServer.setClustered(true);