use of io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg in project zeebe by camunda.
the class SystemContextTest method shouldThrowExceptionIfFixedPartitioningSchemeUsesInvalidPartitionId.
@ParameterizedTest
@ValueSource(ints = { -1, 2 })
void shouldThrowExceptionIfFixedPartitioningSchemeUsesInvalidPartitionId(final int invalidId) {
// given
final BrokerCfg brokerCfg = new BrokerCfg();
final var config = brokerCfg.getExperimental().getPartitioning();
final var fixedPartition = new FixedPartitionCfg();
config.setScheme(Scheme.FIXED);
config.setFixed(List.of(fixedPartition));
fixedPartition.setPartitionId(invalidId);
// when - then
assertThatCode(() -> initSystemContext(brokerCfg)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("Expected fixed partition scheme to define entries with a valid partitionId " + "between 1 and 1, but %d was given", invalidId);
}
use of io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg in project zeebe by camunda.
the class SystemContextTest method shouldNotThrowExceptionIfFixedPartitioningSchemeHasWrongPrioritiesWhenPriorityDisabled.
@Test
void shouldNotThrowExceptionIfFixedPartitioningSchemeHasWrongPrioritiesWhenPriorityDisabled() {
// given
final BrokerCfg brokerCfg = new BrokerCfg();
final var config = brokerCfg.getExperimental().getPartitioning();
final var fixedPartition = new FixedPartitionCfg();
final var nodes = List.of(new NodeCfg(), new NodeCfg());
brokerCfg.getCluster().getRaft().setEnablePriorityElection(false);
brokerCfg.getCluster().setClusterSize(2);
config.setScheme(Scheme.FIXED);
config.setFixed(List.of(fixedPartition));
fixedPartition.setNodes(nodes);
nodes.get(0).setNodeId(0);
nodes.get(0).setPriority(1);
nodes.get(1).setNodeId(1);
nodes.get(1).setPriority(1);
// when - then
assertThatCode(() -> initSystemContext(brokerCfg)).doesNotThrowAnyException();
}
use of io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg in project zeebe by zeebe-io.
the class SystemContextTest method shouldNotThrowExceptionIfFixedPartitioningSchemeHasWrongPrioritiesWhenPriorityDisabled.
@Test
void shouldNotThrowExceptionIfFixedPartitioningSchemeHasWrongPrioritiesWhenPriorityDisabled() {
// given
final BrokerCfg brokerCfg = new BrokerCfg();
final var config = brokerCfg.getExperimental().getPartitioning();
final var fixedPartition = new FixedPartitionCfg();
final var nodes = List.of(new NodeCfg(), new NodeCfg());
brokerCfg.getCluster().getRaft().setEnablePriorityElection(false);
brokerCfg.getCluster().setClusterSize(2);
config.setScheme(Scheme.FIXED);
config.setFixed(List.of(fixedPartition));
fixedPartition.setNodes(nodes);
nodes.get(0).setNodeId(0);
nodes.get(0).setPriority(1);
nodes.get(1).setNodeId(1);
nodes.get(1).setPriority(1);
// when - then
assertThatCode(() -> initSystemContext(brokerCfg)).doesNotThrowAnyException();
}
use of io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg in project zeebe by zeebe-io.
the class SystemContextTest method shouldThrowExceptionIfFixedPartitioningSchemeUsesInvalidPartitionId.
@ParameterizedTest
@ValueSource(ints = { -1, 2 })
void shouldThrowExceptionIfFixedPartitioningSchemeUsesInvalidPartitionId(final int invalidId) {
// given
final BrokerCfg brokerCfg = new BrokerCfg();
final var config = brokerCfg.getExperimental().getPartitioning();
final var fixedPartition = new FixedPartitionCfg();
config.setScheme(Scheme.FIXED);
config.setFixed(List.of(fixedPartition));
fixedPartition.setPartitionId(invalidId);
// when - then
assertThatCode(() -> initSystemContext(brokerCfg)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("Expected fixed partition scheme to define entries with a valid partitionId " + "between 1 and 1, but %d was given", invalidId);
}
use of io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg in project zeebe by camunda-cloud.
the class SystemContextTest method shouldThrowExceptionIfFixedPartitioningSchemeUsesInvalidNodeId.
@ParameterizedTest
@ValueSource(ints = { -1, 2 })
void shouldThrowExceptionIfFixedPartitioningSchemeUsesInvalidNodeId(final int invalidId) {
// given
final BrokerCfg brokerCfg = new BrokerCfg();
final var config = brokerCfg.getExperimental().getPartitioning();
final var fixedPartition = new FixedPartitionCfg();
final var node = new NodeCfg();
config.setScheme(Scheme.FIXED);
config.setFixed(List.of(fixedPartition));
fixedPartition.getNodes().add(node);
node.setNodeId(invalidId);
// when - then
assertThatCode(() -> initSystemContext(brokerCfg)).isInstanceOf(IllegalArgumentException.class).hasMessageContaining("Expected fixed partition scheme for partition 1 to define nodes with a " + "nodeId between 0 and 0, but it was %d", invalidId);
}
Aggregations