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 ec5a5517c3a IGNITE-26098 Add Metastore storage compatibility test 
(#6861)
ec5a5517c3a is described below

commit ec5a5517c3a7d28e9e72ec394486397d33573aa7
Author: Phillippko <[email protected]>
AuthorDate: Thu Oct 30 17:03:44 2025 +0400

    IGNITE-26098 Add Metastore storage compatibility test (#6861)
---
 .../ItMetastorageStorageCompatibilityTest.java     | 64 ++++++++++++++++++++++
 .../internal/MetastorageRaftCompatibilityTest.java | 15 +----
 .../ignite/internal/client/DeploymentUtils.java    | 18 ++++++
 .../compute/SendAllMetastorageCommandTypesJob.java |  3 +-
 4 files changed, 86 insertions(+), 14 deletions(-)

diff --git 
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItMetastorageStorageCompatibilityTest.java
 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItMetastorageStorageCompatibilityTest.java
new file mode 100644
index 00000000000..eff633b1315
--- /dev/null
+++ 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/ItMetastorageStorageCompatibilityTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.CompatibilityTestCommon.TABLE_NAME_TEST;
+import static 
org.apache.ignite.internal.CompatibilityTestCommon.createDefaultTables;
+import static org.apache.ignite.internal.client.DeploymentUtils.runJob;
+
+import io.micronaut.test.extensions.junit5.annotation.MicronautTest;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.client.DeploymentUtils;
+import org.apache.ignite.internal.compute.SendAllMetastorageCommandTypesJob;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/** Compatibility tests for metastorage storage. */
+@ParameterizedClass
+@MethodSource("baseVersions")
+@MicronautTest(rebuildContext = true)
+public class ItMetastorageStorageCompatibilityTest extends 
CompatibilityTestBase {
+    @Override
+    protected int nodesCount() {
+        return 1;
+    }
+
+    @Override
+    protected void setupBaseVersion(Ignite baseIgnite) {
+        DeploymentUtils.deployJobs();
+
+        createDefaultTables(baseIgnite);
+
+        runSendAllMetastorageCommandTypesJob();
+    }
+
+    @Test
+    void testMetastorageStorageCompatibility() {
+        checkMetastorage();
+    }
+
+    private void checkMetastorage() {
+        // Will fail if metastorage is corrupted.
+        sql("SELECT * FROM " + TABLE_NAME_TEST);
+    }
+
+    private void runSendAllMetastorageCommandTypesJob() {
+        runJob(cluster, SendAllMetastorageCommandTypesJob.class, "");
+    }
+}
diff --git 
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/MetastorageRaftCompatibilityTest.java
 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/MetastorageRaftCompatibilityTest.java
index 901db710480..c86997819e5 100644
--- 
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/MetastorageRaftCompatibilityTest.java
+++ 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/MetastorageRaftCompatibilityTest.java
@@ -21,7 +21,7 @@ import static 
org.apache.ignite.internal.AssignmentsTestUtils.awaitAssignmentsSt
 import static 
org.apache.ignite.internal.CompatibilityTestCommon.TABLE_NAME_TEST;
 import static 
org.apache.ignite.internal.CompatibilityTestCommon.createDefaultTables;
 import static org.apache.ignite.internal.TestWrappers.unwrapIgniteImpl;
-import static 
org.apache.ignite.internal.client.ClientCompatibilityTests.JOBS_UNIT;
+import static org.apache.ignite.internal.client.DeploymentUtils.runJob;
 import static 
org.apache.ignite.internal.testframework.IgniteTestUtils.waitForCondition;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -29,9 +29,6 @@ import 
io.micronaut.test.extensions.junit5.annotation.MicronautTest;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import org.apache.ignite.Ignite;
-import org.apache.ignite.client.IgniteClient;
-import org.apache.ignite.compute.JobDescriptor;
-import org.apache.ignite.compute.JobTarget;
 import org.apache.ignite.internal.client.DeploymentUtils;
 import org.apache.ignite.internal.compute.SendAllMetastorageCommandTypesJob;
 import org.apache.ignite.internal.configuration.ComponentWorkingDir;
@@ -114,14 +111,6 @@ public class MetastorageRaftCompatibilityTest extends 
CompatibilityTestBase {
     }
 
     private void runSendAllMetastorageCommandTypesJob() {
-        try (IgniteClient client = cluster.createClient()) {
-            JobDescriptor<String, Void> job = 
JobDescriptor.builder(SendAllMetastorageCommandTypesJob.class)
-                    .units(JOBS_UNIT)
-                    .build();
-
-            JobTarget jobTarget = JobTarget.anyNode(client.cluster().nodes());
-
-            client.compute().execute(jobTarget, job, "");
-        }
+        runJob(cluster, SendAllMetastorageCommandTypesJob.class, "");
     }
 }
diff --git 
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/DeploymentUtils.java
 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/DeploymentUtils.java
index 36735315580..9b70fe72758 100644
--- 
a/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/DeploymentUtils.java
+++ 
b/modules/compatibility-tests/src/integrationTest/java/org/apache/ignite/internal/client/DeploymentUtils.java
@@ -25,6 +25,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import java.io.File;
 import java.nio.file.Path;
 import java.util.List;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.JobDescriptor;
+import org.apache.ignite.compute.JobTarget;
+import org.apache.ignite.internal.IgniteCluster;
 import org.apache.ignite.internal.cli.call.cluster.unit.DeployUnitClient;
 import org.apache.ignite.rest.client.invoker.ApiClient;
 import org.apache.ignite.rest.client.invoker.ApiException;
@@ -53,4 +58,17 @@ public class DeploymentUtils {
             sneakyThrow(e);
         }
     }
+
+    /** Run deployed job. */
+    public static <T, R> R runJob(IgniteCluster cluster, Class<? extends 
ComputeJob<T, R>> jobClass, T arg) {
+        try (IgniteClient client = cluster.createClient()) {
+            JobDescriptor<T, R> job = JobDescriptor.builder(jobClass)
+                    .units(JOBS_UNIT)
+                    .build();
+
+            JobTarget jobTarget = JobTarget.anyNode(client.cluster().nodes());
+
+            return client.compute().execute(jobTarget, job, arg);
+        }
+    }
 }
diff --git 
a/modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/SendAllMetastorageCommandTypesJob.java
 
b/modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/SendAllMetastorageCommandTypesJob.java
index a42cc12aa97..6a4ad330fae 100644
--- 
a/modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/SendAllMetastorageCommandTypesJob.java
+++ 
b/modules/compatibility-tests/src/jobs/java/org/apache/ignite/internal/compute/SendAllMetastorageCommandTypesJob.java
@@ -36,6 +36,7 @@ import 
org.apache.ignite.internal.metastorage.impl.MetaStorageManagerImpl;
 import org.apache.ignite.internal.wrapper.Wrappers;
 
 /** A job that runs different MetastorageWriteCommands. */
+// TODO IGNITE-26874 Add a check that all write commands are covered.
 public class SendAllMetastorageCommandTypesJob implements ComputeJob<String, 
Void> {
     @Override
     public CompletableFuture<Void> executeAsync(JobExecutionContext context, 
String arg) {
@@ -58,7 +59,7 @@ public class SendAllMetastorageCommandTypesJob implements 
ComputeJob<String, Voi
                             iif(exists(ByteArray.fromString("key")), 
ops().yield(), ops().yield())),
                     
metastorage.evictIdempotentCommandsCache(HybridTimestamp.MAX_VALUE),
                     sendCompactionCommand(metastorage)
-            );
+            ).thenCompose((v) -> metastorage.storage().flush());
         } catch (Exception e) {
             throw new RuntimeException(e);
         }

Reply via email to