Search in sources :

Example 1 with FixedPartitionCfg

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);
}
Also used : FixedPartitionCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg) BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with FixedPartitionCfg

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();
}
Also used : FixedPartitionCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg) NodeCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg.NodeCfg) BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with FixedPartitionCfg

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();
}
Also used : FixedPartitionCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg) NodeCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg.NodeCfg) BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with FixedPartitionCfg

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);
}
Also used : FixedPartitionCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg) BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with FixedPartitionCfg

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);
}
Also used : FixedPartitionCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg) NodeCfg(io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg.NodeCfg) BrokerCfg(io.camunda.zeebe.broker.system.configuration.BrokerCfg) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

BrokerCfg (io.camunda.zeebe.broker.system.configuration.BrokerCfg)15 FixedPartitionCfg (io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg)15 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)15 NodeCfg (io.camunda.zeebe.broker.system.configuration.partitioning.FixedPartitionCfg.NodeCfg)12 Test (org.junit.jupiter.api.Test)9 ValueSource (org.junit.jupiter.params.provider.ValueSource)6