tkalkirill commented on code in PR #1874:
URL: https://github.com/apache/ignite-3/pull/1874#discussion_r1154201592


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/BaseMvStoragesTest.java:
##########
@@ -52,11 +52,15 @@
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteException;
 import org.jetbrains.annotations.Nullable;
+import org.junit.jupiter.api.RepeatedTest;
 
 /**
  * Base test for MV storages, contains pojo classes, their descriptor and a 
marshaller instance.
  */
 public abstract class BaseMvStoragesTest {
+    /** To be used in a loop. {@link RepeatedTest} has a smaller failure rate 
due to recreating the storage every time. */
+    protected static final int REPEATS = 100;

Review Comment:
   Fix it



##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/AbstractMvStorageUpdateHandlerTest.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * 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.table.distributed;
+
+import static org.apache.ignite.internal.testframework.IgniteTestUtils.runRace;
+import static 
org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.distributed.TestPartitionDataStorage;
+import 
org.apache.ignite.internal.configuration.testframework.ConfigurationExtension;
+import 
org.apache.ignite.internal.configuration.testframework.InjectConfiguration;
+import 
org.apache.ignite.internal.distributionzones.configuration.DistributionZoneConfiguration;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.schema.BinaryRow;
+import org.apache.ignite.internal.schema.configuration.TableConfiguration;
+import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
+import org.apache.ignite.internal.storage.BaseMvStoragesTest;
+import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.storage.RowId;
+import org.apache.ignite.internal.storage.engine.MvTableStorage;
+import org.apache.ignite.internal.storage.engine.StorageEngine;
+import org.apache.ignite.internal.table.distributed.raft.PartitionDataStorage;
+import org.jetbrains.annotations.Nullable;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/**
+ * Abstract class for testing {@link StorageUpdateHandler} using different 
implementations of {@link MvPartitionStorage}.
+ */
+@ExtendWith(ConfigurationExtension.class)
+abstract class AbstractMvStorageUpdateHandlerTest extends BaseMvStoragesTest {
+    private static final int PARTITION_ID = 0;
+
+    private StorageEngine storageEngine;
+
+    private TestPartitionDataStorage partitionDataStorage;
+
+    private StorageUpdateHandler storageUpdateHandler;
+
+    @BeforeEach
+    void setUp(
+            @InjectConfiguration("mock.tables.foo{}") TablesConfiguration 
tablesConfig,
+            @InjectConfiguration DistributionZoneConfiguration 
distributionZoneConfig
+    ) {
+        storageEngine = createStorageEngine();
+
+        storageEngine.start();
+
+        TableConfiguration tableConfig = tablesConfig.tables().get("foo");
+
+        assertThat(
+                tableConfig.dataStorage().change(dataStorageChange -> 
dataStorageChange.convert(storageEngine.name())),
+                willCompleteSuccessfully()
+        );
+
+        MvTableStorage mvTableStorage = 
storageEngine.createMvTable(tableConfig, tablesConfig, distributionZoneConfig);
+
+        mvTableStorage.start();
+
+        MvPartitionStorage mvPartitionStorage = 
getOrCreateMvPartition(mvTableStorage, PARTITION_ID);
+
+        partitionDataStorage = new 
TestPartitionDataStorage(mvPartitionStorage);
+
+        storageUpdateHandler = new StorageUpdateHandler(PARTITION_ID, 
partitionDataStorage, Map::of, tableConfig.dataStorage());
+    }
+
+    @AfterEach
+    void tearDown() {
+        if (storageEngine != null) {
+            storageEngine.stop();
+        }

Review Comment:
   Fix it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to