use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi by strimzi.
the class EntityTopicOperatorTest method testFromCrdDefault.
@ParallelTest
public void testFromCrdDefault() {
EntityTopicOperatorSpec entityTopicOperatorSpec = new EntityTopicOperatorSpecBuilder().build();
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withTopicOperator(entityTopicOperatorSpec).build();
Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityTopicOperator entityTopicOperator = EntityTopicOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource);
assertThat(entityTopicOperator.watchedNamespace(), is(namespace));
assertThat(entityTopicOperator.getImage(), is("quay.io/strimzi/operator:latest"));
assertThat(entityTopicOperator.reconciliationIntervalMs, is(EntityTopicOperatorSpec.DEFAULT_FULL_RECONCILIATION_INTERVAL_SECONDS * 1000));
assertThat(entityTopicOperator.zookeeperSessionTimeoutMs, is(EntityTopicOperatorSpec.DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_SECONDS * 1000));
assertThat(entityTopicOperator.topicMetadataMaxAttempts, is(EntityTopicOperatorSpec.DEFAULT_TOPIC_METADATA_MAX_ATTEMPTS));
assertThat(entityTopicOperator.zookeeperConnect, is("localhost:2181"));
assertThat(entityTopicOperator.kafkaBootstrapServers, is(KafkaResources.bootstrapServiceName(cluster) + ":" + KafkaCluster.REPLICATION_PORT));
assertThat(entityTopicOperator.resourceLabels, is(ModelUtils.defaultResourceLabels(cluster)));
assertThat(entityTopicOperator.readinessProbeOptions.getInitialDelaySeconds(), is(EntityTopicOperatorSpec.DEFAULT_HEALTHCHECK_DELAY));
assertThat(entityTopicOperator.readinessProbeOptions.getTimeoutSeconds(), is(EntityTopicOperatorSpec.DEFAULT_HEALTHCHECK_TIMEOUT));
assertThat(entityTopicOperator.livenessProbeOptions.getInitialDelaySeconds(), is(EntityTopicOperatorSpec.DEFAULT_HEALTHCHECK_DELAY));
assertThat(entityTopicOperator.livenessProbeOptions.getTimeoutSeconds(), is(EntityTopicOperatorSpec.DEFAULT_HEALTHCHECK_TIMEOUT));
assertThat(entityTopicOperator.getLogging(), is(nullValue()));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi by strimzi.
the class EntityUserOperatorTest method testFromCrdNoUserOperatorInEntityOperator.
@ParallelTest
public void testFromCrdNoUserOperatorInEntityOperator() {
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().build();
Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityUserOperator entityUserOperator = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource, true);
assertThat(entityUserOperator, is(nullValue()));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi by strimzi.
the class EntityUserOperatorTest method testNoWatchedNamespace.
@ParallelTest
public void testNoWatchedNamespace() {
EntityOperatorSpec entityOperatorSpec = new EntityOperatorSpecBuilder().withNewUserOperator().endUserOperator().build();
Kafka resource = new KafkaBuilder(ResourceUtils.createKafka(namespace, cluster, replicas, image, healthDelay, healthTimeout)).editSpec().withEntityOperator(entityOperatorSpec).endSpec().build();
EntityUserOperator entityUserOperator = EntityUserOperator.fromCrd(new Reconciliation("test", resource.getKind(), resource.getMetadata().getNamespace(), resource.getMetadata().getName()), resource, true);
assertThat(entityUserOperator.watchedNamespace(), is(namespace));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi by strimzi.
the class KRaftUtilsTest method testEnabledEntityOperatorOnlyTopicOperator.
@ParallelTest
public void testEnabledEntityOperatorOnlyTopicOperator() {
Set<String> errors = new HashSet<>(0);
EntityOperatorSpec eo = new EntityOperatorSpecBuilder().withNewTopicOperator().endTopicOperator().build();
KRaftUtils.validateEntityOperatorSpec(errors, eo);
assertThat(errors, is(Set.of("Topic Operator is currently not supported when the UseKRaft feature gate is enabled")));
}
use of io.strimzi.api.kafka.model.EntityOperatorSpecBuilder in project strimzi by strimzi.
the class KRaftUtilsTest method testEnabledEntityOperator.
@ParallelTest
public void testEnabledEntityOperator() {
Set<String> errors = new HashSet<>(0);
EntityOperatorSpec eo = new EntityOperatorSpecBuilder().withNewUserOperator().endUserOperator().withNewTopicOperator().endTopicOperator().build();
KRaftUtils.validateEntityOperatorSpec(errors, eo);
assertThat(errors, is(Set.of("Topic Operator is currently not supported when the UseKRaft feature gate is enabled")));
}
Aggregations