use of io.zeebe.broker.clustering.management.message.CreatePartitionRequest in project zeebe by zeebe-io.
the class CreateTopicTest method shouldRejectPartitionCreationAndNotBreak.
@Test
public void shouldRejectPartitionCreationAndNotBreak() {
// given
final ClientTransport transport = apiRule.getTransport();
final RemoteAddress remoteAddress = transport.registerRemoteAndAwaitChannel(BROKER_MGMT_ADDRESS);
final ClientOutput output = transport.getOutput();
final CreatePartitionRequest partitionMessage = new CreatePartitionRequest();
final DirectBuffer topicName = BufferUtil.wrapString("foo");
final int partition1 = 142;
final int partition2 = 143;
partitionMessage.topicName(topicName);
partitionMessage.partitionId(partition1);
// => should create partition
doRepeatedly(() -> output.sendRequest(remoteAddress, partitionMessage)).until(r -> r != null);
// => should be rejected/ignored
doRepeatedly(() -> output.sendRequest(remoteAddress, partitionMessage)).until(r -> r != null);
// when creating another partition
partitionMessage.partitionId(partition2);
doRepeatedly(() -> output.sendRequest(remoteAddress, partitionMessage)).until(r -> r != null);
// then this should be successful (i.e. the rejected request should not have jammed the broker)
waitUntil(() -> arePublished(partition1, partition2));
}
Aggregations