Search in sources :

Example 1 with StrimziPodSetTest

use of io.strimzi.systemtest.annotations.StrimziPodSetTest in project strimzi by strimzi.

the class RecoveryIsolatedST method testRecoveryFromKafkaAndZookeeperPodDeletion.

@IsolatedTest
@StrimziPodSetTest
@KRaftNotSupported("Zookeeper is not supported by KRaft mode and is used in this test class")
void testRecoveryFromKafkaAndZookeeperPodDeletion() {
    final String kafkaName = KafkaResources.kafkaStatefulSetName(sharedClusterName);
    final String zkName = KafkaResources.zookeeperStatefulSetName(sharedClusterName);
    final LabelSelector kafkaSelector = KafkaResource.getLabelSelector(sharedClusterName, kafkaName);
    final LabelSelector zkSelector = KafkaResource.getLabelSelector(sharedClusterName, zkName);
    LOGGER.info("Deleting most of the Kafka and ZK pods");
    List<Pod> kafkaPodList = kubeClient().listPods(kafkaSelector);
    List<Pod> zkPodList = kubeClient().listPods(zkSelector);
    kafkaPodList.subList(0, kafkaPodList.size() - 1).forEach(pod -> kubeClient().deletePod(pod));
    zkPodList.subList(0, zkPodList.size() - 1).forEach(pod -> kubeClient().deletePod(pod));
    StrimziPodSetUtils.waitForAllStrimziPodSetAndPodsReady(kafkaName, KAFKA_REPLICAS);
    StrimziPodSetUtils.waitForAllStrimziPodSetAndPodsReady(zkName, ZOOKEEPER_REPLICAS);
    KafkaUtils.waitForKafkaReady(sharedClusterName);
}
Also used : Pod(io.fabric8.kubernetes.api.model.Pod) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) KRaftNotSupported(io.strimzi.systemtest.annotations.KRaftNotSupported) StrimziPodSetTest(io.strimzi.systemtest.annotations.StrimziPodSetTest) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Example 2 with StrimziPodSetTest

use of io.strimzi.systemtest.annotations.StrimziPodSetTest in project strimzi-kafka-operator by strimzi.

the class RecoveryIsolatedST method testRecoveryFromKafkaAndZookeeperPodDeletion.

@IsolatedTest
@StrimziPodSetTest
@KRaftNotSupported("Zookeeper is not supported by KRaft mode and is used in this test class")
void testRecoveryFromKafkaAndZookeeperPodDeletion() {
    final String kafkaName = KafkaResources.kafkaStatefulSetName(sharedClusterName);
    final String zkName = KafkaResources.zookeeperStatefulSetName(sharedClusterName);
    final LabelSelector kafkaSelector = KafkaResource.getLabelSelector(sharedClusterName, kafkaName);
    final LabelSelector zkSelector = KafkaResource.getLabelSelector(sharedClusterName, zkName);
    LOGGER.info("Deleting most of the Kafka and ZK pods");
    List<Pod> kafkaPodList = kubeClient().listPods(kafkaSelector);
    List<Pod> zkPodList = kubeClient().listPods(zkSelector);
    kafkaPodList.subList(0, kafkaPodList.size() - 1).forEach(pod -> kubeClient().deletePod(pod));
    zkPodList.subList(0, zkPodList.size() - 1).forEach(pod -> kubeClient().deletePod(pod));
    StrimziPodSetUtils.waitForAllStrimziPodSetAndPodsReady(kafkaName, KAFKA_REPLICAS);
    StrimziPodSetUtils.waitForAllStrimziPodSetAndPodsReady(zkName, ZOOKEEPER_REPLICAS);
    KafkaUtils.waitForKafkaReady(sharedClusterName);
}
Also used : Pod(io.fabric8.kubernetes.api.model.Pod) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) KRaftNotSupported(io.strimzi.systemtest.annotations.KRaftNotSupported) StrimziPodSetTest(io.strimzi.systemtest.annotations.StrimziPodSetTest) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Aggregations

LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)2 Pod (io.fabric8.kubernetes.api.model.Pod)2 IsolatedTest (io.strimzi.systemtest.annotations.IsolatedTest)2 KRaftNotSupported (io.strimzi.systemtest.annotations.KRaftNotSupported)2 StrimziPodSetTest (io.strimzi.systemtest.annotations.StrimziPodSetTest)2