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

tkalkirill pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 091b225a5a7 IGNITE-26104 Add CMG snapshot file compatibility test 
(#6929)
091b225a5a7 is described below

commit 091b225a5a7441190054f30d722a1e888c98bf2d
Author: Aditya Mukhopadhyay <[email protected]>
AuthorDate: Tue Nov 11 11:35:35 2025 +0530

    IGNITE-26104 Add CMG snapshot file compatibility test (#6929)
---
 modules/compatibility-tests/build.gradle           |   2 +
 .../ItCmgRaftSnapshotCompatibilityTest.java        | 107 +++++++++++++++++++++
 .../org/apache/ignite/internal/IgniteCluster.java  |  14 +++
 3 files changed, 123 insertions(+)

diff --git a/modules/compatibility-tests/build.gradle 
b/modules/compatibility-tests/build.gradle
index c436d6e2675..6f04add0ad7 100644
--- a/modules/compatibility-tests/build.gradle
+++ b/modules/compatibility-tests/build.gradle
@@ -51,6 +51,8 @@ dependencies {
     integrationTestImplementation project(':ignite-storage-page-memory')
     integrationTestImplementation project(':ignite-metastorage-api')
     integrationTestImplementation project(':ignite-metastorage')
+    integrationTestImplementation project(':ignite-cluster-management')
+    integrationTestImplementation project(':ignite-raft')
     integrationTestImplementation project(':ignite-jdbc')
     integrationTestImplementation project(':ignite-network-api')
     integrationTestAnnotationProcessor 
libs.micronaut.inject.annotation.processor
diff --git 
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItCmgRaftSnapshotCompatibilityTest.java
 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItCmgRaftSnapshotCompatibilityTest.java
new file mode 100644
index 00000000000..6a7ff4487c3
--- /dev/null
+++ 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItCmgRaftSnapshotCompatibilityTest.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+import static org.apache.ignite.internal.jobs.DeploymentUtils.runJob;
+import static org.awaitility.Awaitility.await;
+import static org.hamcrest.core.Is.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.internal.cluster.management.CmgGroupId;
+import org.apache.ignite.internal.compute.TruncateRaftLogCommand;
+import org.apache.ignite.internal.jobs.DeploymentUtils;
+import org.apache.ignite.internal.testframework.log4j2.LogInspector;
+import org.apache.ignite.raft.jraft.core.Replicator;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.AfterParameterizedClassInvocation;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/** Compatibility tests for CMG raft snapshot. */
+@ParameterizedClass
+@MethodSource("baseVersions")
+@MicronautTest(rebuildContext = true)
+public class ItCmgRaftSnapshotCompatibilityTest extends CompatibilityTestBase {
+    private LogInspector replicatorLogInspector;
+
+    @Override
+    protected boolean restartWithCurrentEmbeddedVersion() {
+        return false;
+    }
+
+    @Override
+    protected int nodesCount() {
+        return 2;
+    }
+
+    @Override
+    protected void setupBaseVersion(Ignite baseIgnite) {
+        replicatorLogInspector = LogInspector.create(Replicator.class, true);
+
+        DeploymentUtils.deployJobs();
+    }
+
+    @AfterParameterizedClassInvocation
+    void stopReplicatorLogInspector() {
+        replicatorLogInspector.stop();
+    }
+
+    @Test
+    @Disabled("https://issues.apache.org/jira/browse/IGNITE-26923";)
+    void testCmgRaftSnapshotCompatibility() throws InterruptedException {
+        int nodeIndex = nodesCount() - 1;
+
+        // We want to include the NodesLeave command in the log.
+        cluster.stopRunnerNode(nodeIndex);
+
+        try (IgniteClient ignite = cluster.createClient()) {
+            await().until(() -> ignite.cluster().nodes().size(), 
is(nodesCount() - 1));
+        }
+
+        runTruncateLogCommand();
+
+        cluster.stop();
+        cluster.startEmbedded(nodesCount());
+
+        CountDownLatch snapshotInstalledLatch = snapshotInstalledLatch(0);
+        assertTrue(snapshotInstalledLatch.await(60, TimeUnit.SECONDS), "Did 
not install a snapshot in time");
+    }
+
+    private void runTruncateLogCommand() {
+        runJob(cluster, TruncateRaftLogCommand.class, 
CmgGroupId.INSTANCE.toString());
+    }
+
+    @SuppressWarnings("SameParameterValue")
+    private CountDownLatch snapshotInstalledLatch(int nodeIndex) {
+        CountDownLatch snapshotInstalledLatch = new CountDownLatch(1);
+
+        replicatorLogInspector.addHandler(
+                evt -> evt.getMessage().getFormattedMessage().matches(
+                        "Node \\S+ received InstallSnapshotResponse from " + 
cluster.nodeName(nodeIndex) + " .+ success=true"),
+                snapshotInstalledLatch::countDown
+        );
+
+        return snapshotInstalledLatch;
+    }
+}
diff --git 
a/modules/compatibility-tests/src/testFixtures/java/org/apache/ignite/internal/IgniteCluster.java
 
b/modules/compatibility-tests/src/testFixtures/java/org/apache/ignite/internal/IgniteCluster.java
index 04d9ff18427..7a0c9376893 100644
--- 
a/modules/compatibility-tests/src/testFixtures/java/org/apache/ignite/internal/IgniteCluster.java
+++ 
b/modules/compatibility-tests/src/testFixtures/java/org/apache/ignite/internal/IgniteCluster.java
@@ -426,6 +426,20 @@ public class IgniteCluster {
         }
     }
 
+    /**
+     * Stops the runner node with the given index.
+     *
+     * @param nodeIndex Index of the node to stop.
+     */
+    public void stopRunnerNode(int nodeIndex) {
+        if (nodeIndex < runnerNodes.size()) {
+            runnerNodes.get(nodeIndex).stop();
+            runnerNodes.set(nodeIndex, null);
+        } else {
+            throw new IllegalStateException("Runner node with index " + 
nodeIndex + " is not started");
+        }
+    }
+
     private HttpRequest post(String path, String body) {
         return newBuilder(path)
                 .header("content-type", "application/json")

Reply via email to