use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient in project zeebe by camunda.
the class RollingUpdateTest method takeSnapshot.
private void takeSnapshot(final ZeebeBrokerNode<? extends org.testcontainers.containers.GenericContainer<?>> node) {
final PartitionsActuatorClient partitionsActuatorClient = new PartitionsActuatorClient(node.getExternalMonitoringAddress());
final Either<Throwable, Map<String, PartitionStatus>> result = partitionsActuatorClient.takeSnapshot();
EitherAssert.assertThat(result).as("take snapshot operation was successful").isRight();
}
use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient in project zeebe by camunda.
the class RollingUpdateTest method assertBrokerHasAtLeastOneSnapshot.
private void assertBrokerHasAtLeastOneSnapshot(final int index) {
final ZeebeBrokerNode<?> broker = cluster.getBrokers().get(index);
final PartitionsActuatorClient partitionsActuatorClient = new PartitionsActuatorClient(broker.getExternalMonitoringAddress());
final Either<Throwable, Map<String, PartitionStatus>> response = partitionsActuatorClient.queryPartitions();
EitherAssert.assertThat(response).isRight();
assertThat(response.get()).hasEntrySatisfying("1", status -> assertThat(status.snapshotId).as("partition 1 reports the presence of a snapshot").isNotBlank());
}
use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient in project zeebe by camunda.
the class ContainerState method start.
public void start(final boolean enableDebug, final boolean withRemoteDebugging) {
final String contactPoint;
broker = new ZeebeContainer(ZeebeTestContainerDefaults.defaultTestImage().withTag(brokerVersion)).withEnv("ZEEBE_LOG_LEVEL", "DEBUG").withEnv("ZEEBE_BROKER_NETWORK_MAXMESSAGESIZE", "128KB").withEnv("ZEEBE_BROKER_DATA_LOGSEGMENTSIZE", "64MB").withEnv("ZEEBE_BROKER_DATA_SNAPSHOTPERIOD", "1m").withEnv("ZEEBE_BROKER_DATA_LOGINDEXDENSITY", "1").withZeebeData(volume).withNetwork(network);
this.withRemoteDebugging = withRemoteDebugging;
if (withRemoteDebugging) {
RemoteDebugger.configureContainer(broker);
LOG.info("================================================");
LOG.info("About to start broker....");
LOG.info("The broker will wait for a debugger to connect to it at port " + RemoteDebugger.DEFAULT_REMOTE_DEBUGGER_PORT + ". It will wait for " + RemoteDebugger.DEFAULT_START_TIMEOUT.toString());
LOG.info("================================================");
}
if (enableDebug) {
broker = broker.withEnv("ZEEBE_DEBUG", "true");
}
Failsafe.with(CONTAINER_START_RETRY_POLICY).run(() -> broker.self().start());
if (gatewayVersion == null) {
contactPoint = broker.getExternalGatewayAddress();
} else {
gateway = new ZeebeGatewayContainer(ZeebeTestContainerDefaults.defaultTestImage().withTag(gatewayVersion)).withEnv("ZEEBE_GATEWAY_CLUSTER_CONTACTPOINT", broker.getInternalClusterAddress()).withEnv("ZEEBE_LOG_LEVEL", "DEBUG").withNetwork(network);
Failsafe.with(CONTAINER_START_RETRY_POLICY).run(() -> gateway.self().start());
contactPoint = gateway.getExternalGatewayAddress();
}
client = ZeebeClient.newClientBuilder().gatewayAddress(contactPoint).usePlaintext().build();
partitionsActuatorClient = new PartitionsActuatorClient(broker.getExternalMonitoringAddress());
}
use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient in project zeebe by camunda-cloud.
the class ContainerState method start.
public void start(final boolean enableDebug, final boolean withRemoteDebugging) {
final String contactPoint;
broker = new ZeebeContainer(brokerImage).withEnv("ZEEBE_LOG_LEVEL", "DEBUG").withEnv("ZEEBE_BROKER_NETWORK_MAXMESSAGESIZE", "128KB").withEnv("ZEEBE_BROKER_DATA_LOGSEGMENTSIZE", "64MB").withEnv("ZEEBE_BROKER_DATA_SNAPSHOTPERIOD", "1m").withEnv("ZEEBE_BROKER_DATA_LOGINDEXDENSITY", "1").withZeebeData(volume).withNetwork(network);
this.withRemoteDebugging = withRemoteDebugging;
if (withRemoteDebugging) {
RemoteDebugger.configureContainer(broker);
LOG.info("================================================");
LOG.info("About to start broker....");
LOG.info("The broker will wait for a debugger to connect to it at port " + RemoteDebugger.DEFAULT_REMOTE_DEBUGGER_PORT + ". It will wait for " + RemoteDebugger.DEFAULT_START_TIMEOUT.toString());
LOG.info("================================================");
}
if (enableDebug) {
broker = broker.withEnv("ZEEBE_DEBUG", "true");
}
Failsafe.with(CONTAINER_START_RETRY_POLICY).run(() -> broker.self().start());
if (gatewayImage == null) {
contactPoint = broker.getExternalGatewayAddress();
} else {
gateway = new ZeebeGatewayContainer(gatewayImage).withEnv("ZEEBE_GATEWAY_CLUSTER_CONTACTPOINT", broker.getInternalClusterAddress()).withEnv("ZEEBE_LOG_LEVEL", "DEBUG").withNetwork(network);
Failsafe.with(CONTAINER_START_RETRY_POLICY).run(() -> gateway.self().start());
contactPoint = gateway.getExternalGatewayAddress();
}
client = ZeebeClient.newClientBuilder().gatewayAddress(contactPoint).usePlaintext().build();
partitionsActuatorClient = new PartitionsActuatorClient(broker.getExternalMonitoringAddress());
}
use of io.camunda.zeebe.test.util.actuator.PartitionsActuatorClient in project zeebe by camunda-cloud.
the class RollingUpdateTest method assertBrokerHasAtLeastOneSnapshot.
private void assertBrokerHasAtLeastOneSnapshot(final int index) {
final ZeebeBrokerNode<?> broker = cluster.getBrokers().get(index);
final PartitionsActuatorClient partitionsActuatorClient = new PartitionsActuatorClient(broker.getExternalMonitoringAddress());
final Either<Throwable, Map<String, PartitionStatus>> response = partitionsActuatorClient.queryPartitions();
EitherAssert.assertThat(response).isRight();
assertThat(response.get()).hasEntrySatisfying("1", status -> assertThat(status.snapshotId).as("partition 1 reports the presence of a snapshot").isNotBlank());
}
Aggregations