-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10493: [Backport stable/8.0] fix(raft): handle exceptions on partition server init r=oleschoenburg a=megglos # Description Backport of #10450 to `stable/8.0`. 10566: [Backport stable/8.0] fix(helm): rename podSecurityContext to containerSecurityContext r=oleschoenburg a=backport-action # Description Backport of #10556 to `stable/8.0`. relates to camunda/camunda-platform-helm#374 10624: [Backport stable/8.0] fix: take snapshot if nothing was exported since last snapshot r=oleschoenburg a=backport-action # Description Backport of #10611 to `stable/8.0`. relates to #9761 10638: [Backport stable/8.0] test: fix unfinished stubbing of command response writer r=oleschoenburg a=backport-action # Description Backport of #10605 to `stable/8.0`. relates to #10604 Co-authored-by: Meggle (Sebastian Bathke) <sebastian.bathke@camunda.com> Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
- Loading branch information
Showing
9 changed files
with
236 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
atomix/cluster/src/test/java/io/atomix/raft/partition/impl/RaftPartitionServerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.atomix.raft.partition.impl; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import io.atomix.cluster.ClusterMembershipService; | ||
import io.atomix.cluster.MemberId; | ||
import io.atomix.cluster.messaging.ClusterCommunicationService; | ||
import io.atomix.primitive.partition.PartitionId; | ||
import io.atomix.primitive.partition.PartitionMetadata; | ||
import io.atomix.raft.partition.RaftPartition; | ||
import io.atomix.raft.partition.RaftPartitionConfig; | ||
import io.atomix.raft.partition.RaftPartitionGroupConfig; | ||
import java.time.Duration; | ||
import java.util.List; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.ExecutionException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class RaftPartitionServerTest { | ||
|
||
private final RaftPartition raftPartition = mock(RaftPartition.class); | ||
private final RaftPartitionGroupConfig partitionGroupConfig = | ||
mock(RaftPartitionGroupConfig.class); | ||
|
||
@Test | ||
public void testInitServerRuntimeExceptionReturnsExceptionalFuture() { | ||
// given | ||
final MemberId localMemberId = new MemberId("1"); | ||
when(raftPartition.members()).thenReturn(List.of(localMemberId)); | ||
when(raftPartition.id()) | ||
.thenReturn(PartitionId.from("group", Integer.parseInt(localMemberId.id()))); | ||
|
||
when(partitionGroupConfig.getPartitionConfig()).thenReturn(new RaftPartitionConfig()); | ||
|
||
final RaftPartitionServer raftPartitionServer = | ||
new RaftPartitionServer( | ||
raftPartition, | ||
partitionGroupConfig, | ||
localMemberId, | ||
mock(ClusterMembershipService.class), | ||
mock(ClusterCommunicationService.class), | ||
mock(PartitionMetadata.class)); | ||
|
||
// this is called internally by #initServer which we need to ensure does not prevent | ||
// a completableFuture to be returned on failure | ||
when(partitionGroupConfig.getStorageConfig()).thenThrow(RuntimeException.class); | ||
|
||
// when | ||
final CompletableFuture<RaftPartitionServer> raftServerStartFuture = | ||
raftPartitionServer.start(); | ||
|
||
// then | ||
assertThat(raftServerStartFuture) | ||
.failsWithin(Duration.ZERO) | ||
.withThrowableOfType(ExecutionException.class) | ||
.withCauseInstanceOf(RuntimeException.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.