Created
June 13, 2024 08:39
-
-
Save ShubhamRwt/d4c31f6fe35b89eb34803f5bcb78eb96 to your computer and use it in GitHub Desktop.
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(Environment.TEST_SUITE_NAMESPACE, testStorage.getBrokerPoolName(), testStorage.getClusterName(), 3).build(), | |
KafkaNodePoolTemplates.controllerPool(Environment.TEST_SUITE_NAMESPACE, testStorage.getControllerPoolName(), testStorage.getClusterName(), 1).build() | |
) | |
); | |
resourceManager.createResourceWithWait(KafkaTemplates.kafkaWithCruiseControl(testStorage.getClusterName(), 3, 3) | |
.editMetadata() | |
.withNamespace(Environment.TEST_SUITE_NAMESPACE) | |
.endMetadata() | |
.build()); | |
resourceManager.createResourceWithWait(KafkaRebalanceTemplates.kafkaRebalance(testStorage.getClusterName()) | |
.editMetadata() | |
.withNamespace(Environment.TEST_SUITE_NAMESPACE) | |
.endMetadata() | |
.build()); | |
KafkaRebalanceUtils.waitForKafkaRebalanceCustomResourceState(Environment.TEST_SUITE_NAMESPACE, testStorage.getClusterName(), KafkaRebalanceState.ProposalReady); | |
LOGGER.info("Annotating KafkaRebalance: {} with 'approve' anno", testStorage.getClusterName()); | |
KafkaRebalanceUtils.annotateKafkaRebalanceResource(new Reconciliation("test", KafkaRebalance.RESOURCE_KIND, Environment.TEST_SUITE_NAMESPACE, testStorage.getClusterName()), Environment.TEST_SUITE_NAMESPACE, testStorage.getClusterName(), KafkaRebalanceAnnotation.approve); | |
KafkaRebalanceUtils.waitForKafkaRebalanceCustomResourceState(Environment.TEST_SUITE_NAMESPACE, testStorage.getClusterName(), KafkaRebalanceState.Rebalancing); | |
final String ccPodName = PodUtils.getPodNameByPrefix(Environment.TEST_SUITE_NAMESPACE, CruiseControlResources.componentName(testStorage.getClusterName())); | |
PodUtils.deletePodWithWait(Environment.TEST_SUITE_NAMESPACE, 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