sashapolo commented on code in PR #5991: URL: https://github.com/apache/ignite-3/pull/5991#discussion_r2131959970
########## modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java: ########## @@ -260,4 +266,53 @@ void testStopOrder() throws NodeStoppingException { inOrder.verify(zoneResourcesManager, timeout(1_000)).destroyZonePartitionResources(zonePartitionId); inOrder.verify(replicaManager, timeout(1_000)).destroyReplicationProtocolStorages(zonePartitionId, false); } + + @Test + void producesEventsOnPartitionRestart() { + var beforeReplicaStoppedFuture = new CompletableFuture<LocalPartitionReplicaEventParameters>(); + var afterReplicaStoppedFuture = new CompletableFuture<LocalPartitionReplicaEventParameters>(); + + partitionReplicaLifecycleManager.listen(BEFORE_REPLICA_STOPPED, EventListener.fromConsumer(beforeReplicaStoppedFuture::complete)); + partitionReplicaLifecycleManager.listen(AFTER_REPLICA_STOPPED, EventListener.fromConsumer(params -> { + beforeReplicaStoppedFuture.thenRun(() -> afterReplicaStoppedFuture.complete(params)); Review Comment: The original idea was to guarantee that `before` was fired before `after`, but now I understood that it makes no sense) ########## modules/partition-replicator/src/test/java/org/apache/ignite/internal/partition/replicator/PartitionReplicaLifecycleManagerTest.java: ########## @@ -260,4 +266,53 @@ void testStopOrder() throws NodeStoppingException { inOrder.verify(zoneResourcesManager, timeout(1_000)).destroyZonePartitionResources(zonePartitionId); inOrder.verify(replicaManager, timeout(1_000)).destroyReplicationProtocolStorages(zonePartitionId, false); } + + @Test + void producesEventsOnPartitionRestart() { + var beforeReplicaStoppedFuture = new CompletableFuture<LocalPartitionReplicaEventParameters>(); + var afterReplicaStoppedFuture = new CompletableFuture<LocalPartitionReplicaEventParameters>(); + + partitionReplicaLifecycleManager.listen(BEFORE_REPLICA_STOPPED, EventListener.fromConsumer(beforeReplicaStoppedFuture::complete)); + partitionReplicaLifecycleManager.listen(AFTER_REPLICA_STOPPED, EventListener.fromConsumer(params -> { + beforeReplicaStoppedFuture.thenRun(() -> afterReplicaStoppedFuture.complete(params)); Review Comment: The original idea was to guarantee that `before` was fired before `after`, but now I understand that it makes no sense) -- 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