rpuch commented on code in PR #4987:
URL: https://github.com/apache/ignite-3/pull/4987#discussion_r1925367963


##########
modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftDestructorTest.java:
##########
@@ -28,118 +29,91 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Objects;
-import java.util.stream.Stream;
-import org.apache.ignite.internal.cluster.management.CmgGroupId;
 import org.apache.ignite.internal.lang.IgniteInternalException;
-import org.apache.ignite.internal.metastorage.server.raft.MetastorageGroupId;
 import org.apache.ignite.internal.raft.Peer;
 import org.apache.ignite.internal.raft.RaftNodeId;
 import org.apache.ignite.internal.raft.server.RaftGroupOptions;
 import org.apache.ignite.internal.raft.server.impl.JraftServerImpl;
 import org.apache.ignite.internal.raft.storage.LogStorageFactory;
 import org.apache.ignite.internal.raft.storage.impl.LogStorageException;
-import org.apache.ignite.internal.replicator.ReplicationGroupId;
-import org.apache.ignite.internal.replicator.TablePartitionId;
-import org.junit.jupiter.api.BeforeEach;
+import org.apache.ignite.internal.replicator.TestReplicationGroupId;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.MethodSource;
 
 /** Tests that check that failed storage destruction is finished after server 
restart. */
 public class ItJraftDestructorTest extends JraftAbstractTest {
+    private static final int SERVER_INDEX = 0;
 
-    private static Stream<ReplicationGroupId> groupIdProvider() {
-        return Stream.of(
-                new TablePartitionId(0, 0),
-                CmgGroupId.INSTANCE,
-                MetastorageGroupId.INSTANCE
-        );
-    }
-
-    private JraftServerImpl server;
-    private Path serverDataPath;
-    private Peer peer;
-
-    @BeforeEach
-    void setUp() {
-        server = startServer();
-
-        serverDataPath = serverWorkingDirs.get(0).basePath();
-
-        String localNodeName = 
server.clusterService().topologyService().localMember().name();
+    @Test
+    void testFinishStorageDestructionAfterRestart() throws Exception {
+        doTestFinishStorageDestructionAfterRestart(false);
 
-        peer = Objects.requireNonNull(initialMembersConf.peer(localNodeName));
+        // New log storage factory was created after restart.
+        verify(logStorageFactories.get(SERVER_INDEX), 
times(1)).destroyLogStorage(anyString());
+    }
 
-        LogStorageFactory logStorageFactory = logStorageFactories.get(0);
+    @Test
+    void testVolatileLogStorageIsNotDestroyedOnRestart() throws Exception {
+        doTestFinishStorageDestructionAfterRestart(true);
 
-        
doThrow(LogStorageException.class).doCallRealMethod().when(logStorageFactory).destroyLogStorage(anyString());
+        // New log storage factory was created after restart.
+        verify(logStorageFactories.get(SERVER_INDEX), 
times(0)).destroyLogStorage(anyString());

Review Comment:
   There is `never()` that can be used instead of `times(0)`. Up to you



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to