Skip to content

Commit

Permalink
Add a testcase to KafkaRebalanceStateMachineTest
Browse files Browse the repository at this point in the history
Signed-off-by: Gantigmaa Selenge <tina.selenge@gmail.com>
  • Loading branch information
tinaselenge committed Oct 17, 2024
1 parent c8b8da4 commit 424bafd
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,27 @@ private void krStoppedRefreshToPendingProposal(Vertx vertx, VertxTestContext con
.onComplete(result -> checkOptimizationResults(result, context, true));
}

/**
* Tests the transition from 'Rebalancing' to 'ProposalReady' when refresh
*
* 1. A new KafkaRebalance resource is created and annotated with strimzi.io/rebalance=refresh; it is in the Rebalancing state
* 2. The operator calls the /stop_proposal_execution to stop the ongoing rebalance execution
* 3. The operator sends a request for a new proposal
* 4. The operator computes the next state on the proposal via the Cruise Control REST API
* 5. The rebalance proposal is ready on the first call
* 6. The KafkaRebalance resource moves to the 'ProposalReady' state
*/
@Test
public void testRebalancingToRefreshProposalReady(Vertx vertx, VertxTestContext context) throws IOException, URISyntaxException {
KafkaRebalance kcRebalance = createKafkaRebalance(KafkaRebalanceState.Rebalancing, "", "refresh", REMOVE_BROKER_KAFKA_REBALANCE_SPEC, null, false);
cruiseControlServer.setupCCStopResponse();
cruiseControlServer.setupCCRebalanceResponse(0, CruiseControlEndpoints.REMOVE_BROKER);
checkTransition(vertx, context,
KafkaRebalanceState.Rebalancing, KafkaRebalanceState.ProposalReady,
kcRebalance)
.onComplete(result -> checkOptimizationResults(result, context, false));
}

/**
* Tests the transition from 'Stopped' to 'ProposalReady' when refresh
*
Expand Down

0 comments on commit 424bafd

Please sign in to comment.