Last active
June 12, 2024 12:55
-
-
Save ShubhamRwt/2a820d47733140634eb3cc0b27002a51 to your computer and use it in GitHub Desktop.
CC test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IsolatedTest | |
void testCruiseControlChangesToProposalReadyWhenRestartedWhileRebalancing() { | |
TestStorage testStorage = new TestStorage(ResourceManager.getTestContext()); | |
resourceManager.createResourceWithWait( | |
NodePoolsConverter.convertNodePoolsIfNeeded( | |
KafkaNodePoolTemplates.brokerPool(clusterOperator.getDeploymentNamespace(), testStorage.getBrokerPoolName(), testStorage.getClusterName(), 3).build(), | |
KafkaNodePoolTemplates.controllerPool(clusterOperator.getDeploymentNamespace(), testStorage.getControllerPoolName(), testStorage.getClusterName(), 1).build() | |
) | |
); | |
resourceManager.createResourceWithWait(KafkaTemplates.kafkaWithCruiseControl(testStorage.getClusterName(), 3, 1).build()); | |
resourceManager.createResourceWithWait(KafkaRebalanceTemplates.kafkaRebalance(testStorage.getClusterName()) | |
.editMetadata() | |
.withNamespace(clusterOperator.getDeploymentNamespace()) | |
.endMetadata() | |
.build()); | |
KafkaRebalanceUtils.waitForKafkaRebalanceCustomResourceState(clusterOperator.getDeploymentNamespace(), testStorage.getClusterName(), KafkaRebalanceState.ProposalReady); | |
LOGGER.info("Annotating KafkaRebalance: {} with 'approve' anno", testStorage.getClusterName()); | |
KafkaRebalanceUtils.annotateKafkaRebalanceResource(new Reconciliation("test", KafkaRebalance.RESOURCE_KIND, clusterOperator.getDeploymentNamespace(), testStorage.getClusterName()), clusterOperator.getDeploymentNamespace(), testStorage.getClusterName(), KafkaRebalanceAnnotation.approve); | |
// updating the KafkaRebalance resource by configuring replication throttle | |
final String ccPodName = PodUtils.getPodNameByPrefix(testStorage.getNamespaceName(), CruiseControlResources.componentName(testStorage.getClusterName())); | |
LOGGER.info("ccPodName = {}", ccPodName); | |
PodUtils.deletePodWithWait(testStorage.getNamespaceName(), ccPodName); | |
kubeClient().deletePodWithName(testStorage.getNamespaceName(), ccPodName); | |
/ | |
// the resource moved to `ProposalReady` state | |
KafkaRebalanceUtils.waitForKafkaRebalanceCustomResourceState(clusterOperator.getDeploymentNamespace(), testStorage.getClusterName(), KafkaRebalanceState.ProposalReady); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment