You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2024/09/09 19:50:54 UTC

(activemq-artemis) branch main updated: ARTEMIS-5010 Adding Failback scenario to ReplicatedBothNodesMirrorTest

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new e322a418ce ARTEMIS-5010 Adding Failback scenario to ReplicatedBothNodesMirrorTest
e322a418ce is described below

commit e322a418ce040e280028208999f92f6311b9c6ac
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Mon Sep 9 15:10:13 2024 -0400

    ARTEMIS-5010 Adding Failback scenario to ReplicatedBothNodesMirrorTest
---
 .../mirror/ReplicatedBothNodesMirrorTest.java              | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 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 133387be81..147b68251e 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
@@ -202,6 +202,7 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase {
       assertTrue(brokerXml.exists());
       assertTrue(FileUtil.findReplace(brokerXml, "<page-size-bytes>10M</page-size-bytes>", "<page-size-bytes>100K</page-size-bytes>"));
       assertTrue(FileUtil.findReplace(brokerXml, "amqpDuplicateDetection=true;", "amqpDuplicateDetection=true;ackManagerFlushTimeout=" + TimeUnit.MINUTES.toMillis(10) + ";"));
+      assertTrue(FileUtil.findReplace(brokerXml, "<vote-on-replication-failure>true</vote-on-replication-failure>", "<vote-on-replication-failure>false</vote-on-replication-failure> <check-for-active-server>true</check-for-active-server>"));
 
       if (TRACE_LOGS) {
          replaceLogs(serverLocation);
@@ -273,6 +274,7 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase {
       File brokerXml = new File(serverLocation, "/etc/broker.xml");
       assertTrue(brokerXml.exists());
       assertTrue(FileUtil.findReplace(brokerXml, "amqpDuplicateDetection=true;", "amqpDuplicateDetection=true;ackManagerFlushTimeout=" + TimeUnit.MINUTES.toMillis(10) + ";"));
+      assertTrue(FileUtil.findReplace(brokerXml, "<backup/>", "<backup><allow-failback>true</allow-failback></backup>"));
 
       if (TRACE_LOGS) {
          replaceLogs(serverLocation);
@@ -370,8 +372,10 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase {
       ConnectionFactory connectionFactoryDC1A = CFUtil.createConnectionFactory(protocol, uri(DC1_IP));
 
       final int startAt = 300;
-      final int killAt = 800;
-      final int totalMessages = 1_600;
+      final int killAt = 500;
+      final int failbackAt = 700;
+      final int lastKillAt = 1200;
+      final int totalMessages = 1_800;
       String snfQueue = "$ACTIVEMQ_ARTEMIS_MIRROR_mirror";
 
       try (Connection connection = connectionFactoryDC1A.createConnection()) {
@@ -390,12 +394,16 @@ public class ReplicatedBothNodesMirrorTest extends SoakTestBase {
                // lazy start to allow messages accumulated in the SNF
                processDC2 = startServer(DC2_NODE, -1, -1, new File(getServerLocation(DC2_NODE), "broker.properties"));
                processDC2_REPLICA = startServer(DC2_REPLICA_NODE, -1, -1, new File(getServerLocation(DC2_REPLICA_NODE), "broker.properties"));
-            } else if (i == killAt) { // kill the live on DC2
+            } else if (i == killAt || i == lastKillAt) { // kill the live on DC2
                logger.info("KillAt {}", killAt);
                ServerUtil.waitForServerToStart(2, 10_000);
                Wait.assertTrue(managementDC2::isReplicaSync);
                processDC2.destroyForcibly();
                assertTrue(processDC2.waitFor(10, TimeUnit.SECONDS));
+            } else if (i == failbackAt) {
+               logger.info("Failing back at {}", failbackAt);
+               processDC2 = startServer(DC2_NODE, -1, -1, new File(getServerLocation(DC2_NODE), "broker.properties"));
+               ServerUtil.waitForServerToStart(2, 10_000);
             }
 
             String text = "hello hello hello " + i;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact