JAkutenshi commented on code in PR #6072:
URL: https://github.com/apache/ignite-3/pull/6072#discussion_r2161218853


##########
modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java:
##########
@@ -324,4 +378,55 @@ void producesEventsOnPartitionDestroy() {
         
assertThat(beforeReplicaDestroyedFuture.thenApply(LocalPartitionReplicaEventParameters::zonePartitionId),
 willBe(zonePartitionId));
         
assertThat(afterReplicaDestroyedFuture.thenApply(LocalPartitionReplicaEventParameters::zonePartitionId),
 willBe(zonePartitionId));
     }
+
+    @Test
+    public void 
partitionLifecycleManagerStopsCorrectWhenAllComponentsAreStoppedFine() throws 
Exception {
+        assertDoesNotThrow(() -> 
partitionReplicaLifecycleManager.beforeNodeStop());
+
+        assertThat(partitionReplicaLifecycleManager.stopAsync(), 
willCompleteSuccessfully());
+
+        verify(replicaManager, 
times(CatalogUtils.DEFAULT_PARTITION_COUNT)).stopReplica(any());
+    }
+
+    @Test
+    public void 
partitionLifecycleManagerStopsCorrectWhenReplicasAreStoppedExceptionally() 
throws Exception {
+        when(replicaManager.stopReplica(any())).thenThrow(new 
NodeStoppingException());
+
+        assertDoesNotThrow(() -> 
partitionReplicaLifecycleManager.beforeNodeStop());
+
+        assertThat(partitionReplicaLifecycleManager.stopAsync(), 
willCompleteSuccessfully());
+
+        // One more because of exceptional mock above counts.

Review Comment:
   `when(replicaManager.stopReplica(any())).thenThrow(new 
NodeStoppingException());`



-- 
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