Search in sources :

Example 1 with KafkaTopicSpec

use of io.strimzi.api.kafka.model.KafkaTopicSpec in project strimzi by strimzi.

the class CruiseControlST method testAutoCreationOfCruiseControlTopics.

@IsolatedTest
void testAutoCreationOfCruiseControlTopics(ExtensionContext extensionContext) {
    final String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaWithCruiseControl(clusterName, 3, 3).editMetadata().withNamespace(namespace).endMetadata().editOrNewSpec().editKafka().addToConfig("auto.create.topics.enable", "false").endKafka().endSpec().build());
    KafkaTopicUtils.waitForKafkaTopicReady(namespace, CRUISE_CONTROL_METRICS_TOPIC);
    KafkaTopicSpec metricsTopic = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(CRUISE_CONTROL_METRICS_TOPIC).get().getSpec();
    KafkaTopicUtils.waitForKafkaTopicReady(namespace, CRUISE_CONTROL_MODEL_TRAINING_SAMPLES_TOPIC);
    KafkaTopicSpec modelTrainingTopic = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(CRUISE_CONTROL_MODEL_TRAINING_SAMPLES_TOPIC).get().getSpec();
    KafkaTopicUtils.waitForKafkaTopicReady(namespace, CRUISE_CONTROL_PARTITION_METRICS_SAMPLES_TOPIC);
    KafkaTopicSpec partitionMetricsTopic = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(CRUISE_CONTROL_PARTITION_METRICS_SAMPLES_TOPIC).get().getSpec();
    LOGGER.info("Checking partitions and replicas for {}", CRUISE_CONTROL_METRICS_TOPIC);
    assertThat(metricsTopic.getPartitions(), is(1));
    assertThat(metricsTopic.getReplicas(), is(3));
    LOGGER.info("Checking partitions and replicas for {}", CRUISE_CONTROL_MODEL_TRAINING_SAMPLES_TOPIC);
    assertThat(modelTrainingTopic.getPartitions(), is(32));
    assertThat(modelTrainingTopic.getReplicas(), is(2));
    LOGGER.info("Checking partitions and replicas for {}", CRUISE_CONTROL_PARTITION_METRICS_SAMPLES_TOPIC);
    assertThat(partitionMetricsTopic.getPartitions(), is(32));
    assertThat(partitionMetricsTopic.getReplicas(), is(2));
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) KafkaTopicSpec(io.strimzi.api.kafka.model.KafkaTopicSpec) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Example 2 with KafkaTopicSpec

use of io.strimzi.api.kafka.model.KafkaTopicSpec in project strimzi by strimzi.

the class TopicSerializationTest method testNoConfig.

@Test
public void testNoConfig() {
    KafkaTopicSpec spec = new KafkaTopicSpec();
    spec.setPartitions(3);
    spec.setReplicas(3);
    KafkaTopic kafkaTopic = new KafkaTopic();
    kafkaTopic.setMetadata(new ObjectMetaBuilder().withName("my-topic").build());
    kafkaTopic.setSpec(spec);
    TopicSerialization.fromTopicResource(kafkaTopic);
}
Also used : KafkaTopic(io.strimzi.api.kafka.model.KafkaTopic) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) KafkaTopicSpec(io.strimzi.api.kafka.model.KafkaTopicSpec) Test(org.junit.jupiter.api.Test)

Example 3 with KafkaTopicSpec

use of io.strimzi.api.kafka.model.KafkaTopicSpec in project strimzi-kafka-operator by strimzi.

the class TopicSerializationTest method testNoConfig.

@Test
public void testNoConfig() {
    KafkaTopicSpec spec = new KafkaTopicSpec();
    spec.setPartitions(3);
    spec.setReplicas(3);
    KafkaTopic kafkaTopic = new KafkaTopic();
    kafkaTopic.setMetadata(new ObjectMetaBuilder().withName("my-topic").build());
    kafkaTopic.setSpec(spec);
    TopicSerialization.fromTopicResource(kafkaTopic);
}
Also used : KafkaTopic(io.strimzi.api.kafka.model.KafkaTopic) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) KafkaTopicSpec(io.strimzi.api.kafka.model.KafkaTopicSpec) Test(org.junit.jupiter.api.Test)

Example 4 with KafkaTopicSpec

use of io.strimzi.api.kafka.model.KafkaTopicSpec in project strimzi-kafka-operator by strimzi.

the class CruiseControlST method testAutoCreationOfCruiseControlTopics.

@IsolatedTest
void testAutoCreationOfCruiseControlTopics(ExtensionContext extensionContext) {
    final String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaWithCruiseControl(clusterName, 3, 3).editMetadata().withNamespace(namespace).endMetadata().editOrNewSpec().editKafka().addToConfig("auto.create.topics.enable", "false").endKafka().endSpec().build());
    KafkaTopicUtils.waitForKafkaTopicReady(namespace, CRUISE_CONTROL_METRICS_TOPIC);
    KafkaTopicSpec metricsTopic = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(CRUISE_CONTROL_METRICS_TOPIC).get().getSpec();
    KafkaTopicUtils.waitForKafkaTopicReady(namespace, CRUISE_CONTROL_MODEL_TRAINING_SAMPLES_TOPIC);
    KafkaTopicSpec modelTrainingTopic = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(CRUISE_CONTROL_MODEL_TRAINING_SAMPLES_TOPIC).get().getSpec();
    KafkaTopicUtils.waitForKafkaTopicReady(namespace, CRUISE_CONTROL_PARTITION_METRICS_SAMPLES_TOPIC);
    KafkaTopicSpec partitionMetricsTopic = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(CRUISE_CONTROL_PARTITION_METRICS_SAMPLES_TOPIC).get().getSpec();
    LOGGER.info("Checking partitions and replicas for {}", CRUISE_CONTROL_METRICS_TOPIC);
    assertThat(metricsTopic.getPartitions(), is(1));
    assertThat(metricsTopic.getReplicas(), is(3));
    LOGGER.info("Checking partitions and replicas for {}", CRUISE_CONTROL_MODEL_TRAINING_SAMPLES_TOPIC);
    assertThat(modelTrainingTopic.getPartitions(), is(32));
    assertThat(modelTrainingTopic.getReplicas(), is(2));
    LOGGER.info("Checking partitions and replicas for {}", CRUISE_CONTROL_PARTITION_METRICS_SAMPLES_TOPIC);
    assertThat(partitionMetricsTopic.getPartitions(), is(32));
    assertThat(partitionMetricsTopic.getReplicas(), is(2));
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) KafkaTopicSpec(io.strimzi.api.kafka.model.KafkaTopicSpec) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Aggregations

KafkaTopicSpec (io.strimzi.api.kafka.model.KafkaTopicSpec)4 ObjectMetaBuilder (io.fabric8.kubernetes.api.model.ObjectMetaBuilder)2 KafkaTopic (io.strimzi.api.kafka.model.KafkaTopic)2 IsolatedTest (io.strimzi.systemtest.annotations.IsolatedTest)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Test (org.junit.jupiter.api.Test)2