use of io.strimzi.api.kafka.model.KafkaRebalance in project strimzi by strimzi.
the class KafkaRebalanceAssemblyOperatorTest method testNewToPendingProposalDeleteAddBroker.
/**
* See the {@link KafkaRebalanceAssemblyOperatorTest#testNewToPendingProposalDeleteRebalance} for description
*/
@Test
public void testNewToPendingProposalDeleteAddBroker(VertxTestContext context) throws IOException, URISyntaxException {
KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, ADD_BROKER_KAFKA_REBALANCE_SPEC);
this.krNewToPendingProposalDelete(context, 2, CruiseControlEndpoints.ADD_BROKER, kr);
}
use of io.strimzi.api.kafka.model.KafkaRebalance in project strimzi by strimzi.
the class KafkaRebalanceAssemblyOperatorTest method testNewToProposalReadySkipHardGoalsRemoveBroker.
/**
* See the {@link KafkaRebalanceAssemblyOperatorTest#testNewToProposalReadySkipHardGoalsRebalance} for description
*/
@Test
public void testNewToProposalReadySkipHardGoalsRemoveBroker(VertxTestContext context) throws IOException, URISyntaxException {
KafkaRebalanceSpec kafkaRebalanceSpec = new KafkaRebalanceSpecBuilder().withMode(KafkaRebalanceMode.REMOVE_BROKERS).withBrokers(3).withGoals("DiskCapacityGoal", "CpuCapacityGoal").withSkipHardGoalCheck(true).build();
KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, kafkaRebalanceSpec);
this.krNewToProposalReadySkipHardGoals(context, 0, CruiseControlEndpoints.REMOVE_BROKER, kr);
}
use of io.strimzi.api.kafka.model.KafkaRebalance in project strimzi by strimzi.
the class KafkaRebalanceAssemblyOperatorTest method testNewToPendingProposalToProposalReadyRemoveBroker.
/**
* See the {@link KafkaRebalanceAssemblyOperatorTest#testNewToPendingProposalToProposalReadyRebalance} for description
*/
@Test
public void testNewToPendingProposalToProposalReadyRemoveBroker(VertxTestContext context) throws IOException, URISyntaxException {
KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, REMOVE_BROKER_KAFKA_REBALANCE_SPEC);
this.krNewToPendingProposalToProposalReady(context, 2, CruiseControlEndpoints.REMOVE_BROKER, kr);
}
use of io.strimzi.api.kafka.model.KafkaRebalance in project strimzi by strimzi.
the class KafkaRebalanceAssemblyOperatorTest method testCruiseControlTimingOut.
/**
* Test the Cruise Control API REST client timing out
*
* 1. A new KafkaRebalance resource is created; it is in the 'New' state
* 2. The operator requests a rebalance proposal through the Cruise Control REST API
* 3. The operator doesn't get a response on time; the resource moves to NotReady
*/
@Test
public void testCruiseControlTimingOut(VertxTestContext context) throws IOException, URISyntaxException {
// Setup the rebalance endpoint with the number of pending calls before a response is received
// and with a delay on response higher than the client timeout to test timing out
MockCruiseControl.setupCCRebalanceResponse(ccServer, 0, 10, CruiseControlEndpoints.REBALANCE);
KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, EMPTY_KAFKA_REBALANCE_SPEC);
Crds.kafkaRebalanceOperation(client).inNamespace(CLUSTER_NAMESPACE).create(kr);
when(mockKafkaOps.getAsync(CLUSTER_NAMESPACE, CLUSTER_NAME)).thenReturn(Future.succeededFuture(kafka));
mockSecretResources();
mockRebalanceOperator(mockRebalanceOps, mockCmOps, CLUSTER_NAMESPACE, RESOURCE_NAME, client);
Checkpoint checkpoint = context.checkpoint();
kcrao.reconcileRebalance(new Reconciliation("test-trigger", KafkaRebalance.RESOURCE_KIND, CLUSTER_NAMESPACE, RESOURCE_NAME), kr).onComplete(context.succeeding(v -> {
// the resource moved from New to NotReady (mocked Cruise Control didn't reply on time)
assertState(context, client, CLUSTER_NAMESPACE, RESOURCE_NAME, KafkaRebalanceState.NotReady, NoStackTraceTimeoutException.class, "The timeout period of 1000ms has been exceeded while executing POST");
checkpoint.flag();
}));
}
use of io.strimzi.api.kafka.model.KafkaRebalance in project strimzi by strimzi.
the class KafkaRebalanceAssemblyOperatorTest method testNewToPendingProposalToStoppedAndRefreshRebalance.
/**
* Tests the transition from 'New' to 'PendingProposal' to 'Stopped' (via annotation)
* The resource is refreshed and transitions to 'PendingProposal' again and finally to 'ProposalReady'
*
* 1. A new KafkaRebalance resource is created; it is in the 'New' state
* 2. The operator requests a rebalance proposal through the Cruise Control REST API
* 3. The rebalance proposal is not ready yet; the operator starts polling the Cruise Control REST API
* 4. The KafkaRebalance resource transitions to the 'PendingProposal' state
* 6. While the operator is waiting for the proposal, the KafkaRebalance resource is annotated with 'strimzi.io/rebalance=stop'
* 7. The operator stops polling the Cruise Control REST API
* 8. The KafkaRebalance resource moves to the 'Stopped' state
* 9. The KafkaRebalance resource is annotated with 'strimzi.io/rebalance=refresh'
* 10. The operator requests a rebalance proposal through the Cruise Control REST API
* 11. The rebalance proposal is not ready yet; the operator starts polling the Cruise Control REST API
* 12. The KafkaRebalance resource moves to PendingProposal state
* 13. The rebalance proposal is ready after the specified pending calls
* 14. The KafkaRebalance resource moves to ProposalReady state
*/
@Test
public void testNewToPendingProposalToStoppedAndRefreshRebalance(VertxTestContext context) throws IOException, URISyntaxException {
KafkaRebalance kr = createKafkaRebalance(CLUSTER_NAMESPACE, CLUSTER_NAME, RESOURCE_NAME, EMPTY_KAFKA_REBALANCE_SPEC);
this.krNewToPendingProposalToStoppedAndRefresh(context, 2, CruiseControlEndpoints.REBALANCE, kr);
}
Aggregations