Search in sources :

Example 61 with Condition

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

the class KafkaSpecCheckerTest method checkInterBrokerProtocolWithCorrectLongVersion.

@Test
public void checkInterBrokerProtocolWithCorrectLongVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.INTERBROKER_PROTOCOL_VERSION, KafkaVersionTestUtils.LATEST_PROTOCOL_VERSION + "-IV0");
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(0));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 62 with Condition

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

the class KafkaSpecCheckerTest method checkReplicationFactorAndMinInsyncReplicasNotSet.

@Test
public void checkReplicationFactorAndMinInsyncReplicasNotSet() {
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, emptyMap(), emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(2));
    assertThat(warnings.stream().anyMatch(w -> w.getMessage().contains(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR)), is(true));
    assertThat(warnings.stream().anyMatch(w -> w.getMessage().contains(KafkaConfiguration.MIN_INSYNC_REPLICAS)), is(true));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) CoreMatchers.is(org.hamcrest.CoreMatchers.is) Collections.emptyMap(java.util.Collections.emptyMap) Matchers.empty(org.hamcrest.Matchers.empty) JbodStorageBuilder(io.strimzi.api.kafka.model.storage.JbodStorageBuilder) KafkaVersion(io.strimzi.operator.cluster.model.KafkaVersion) EphemeralStorageBuilder(io.strimzi.api.kafka.model.storage.EphemeralStorageBuilder) HashMap(java.util.HashMap) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) Test(org.junit.jupiter.api.Test) Reconciliation(io.strimzi.operator.common.Reconciliation) List(java.util.List) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) KafkaConfiguration(io.strimzi.operator.cluster.model.KafkaConfiguration) KafkaListenerType(io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType) KafkaCluster(io.strimzi.operator.cluster.model.KafkaCluster) KafkaVersionTestUtils(io.strimzi.operator.cluster.KafkaVersionTestUtils) Map(java.util.Map) Condition(io.strimzi.api.kafka.model.status.Condition) ResourceUtils(io.strimzi.operator.cluster.ResourceUtils) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Kafka(io.strimzi.api.kafka.model.Kafka) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 63 with Condition

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

the class KafkaSpecCheckerTest method checkReplicationFactorAndMinInsyncReplicasSetToOne.

@Test
public void checkReplicationFactorAndMinInsyncReplicasSetToOne() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 1);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 1);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(0));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 64 with Condition

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

the class KafkaSpecCheckerTest method checkLogMessageFormatWithRightVersion.

@Test
public void checkLogMessageFormatWithRightVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.LOG_MESSAGE_FORMAT_VERSION, KafkaVersionTestUtils.LATEST_FORMAT_VERSION);
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(0));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 65 with Condition

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

the class KafkaSpecCheckerTest method checkInterBrokerProtocolWithoutVersion.

@Test
public void checkInterBrokerProtocolWithoutVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.INTERBROKER_PROTOCOL_VERSION, KafkaVersionTestUtils.PREVIOUS_PROTOCOL_VERSION);
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null);
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(1));
    Condition warning = warnings.get(0);
    assertThat(warning.getReason(), is("KafkaInterBrokerProtocolVersion"));
    assertThat(warning.getStatus(), is("True"));
    assertThat(warning.getMessage(), is("inter.broker.protocol.version does not match the Kafka cluster version, which suggests that an upgrade is incomplete."));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Aggregations

Condition (io.strimzi.api.kafka.model.status.Condition)150 Test (org.junit.jupiter.api.Test)70 Kafka (io.strimzi.api.kafka.model.Kafka)61 HashMap (java.util.HashMap)49 EphemeralStorage (io.strimzi.api.kafka.model.storage.EphemeralStorage)42 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)38 Collections (java.util.Collections)37 Vertx (io.vertx.core.Vertx)36 Map (java.util.Map)36 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)34 Labels (io.strimzi.operator.common.model.Labels)34 Future (io.vertx.core.Future)34 BeforeAll (org.junit.jupiter.api.BeforeAll)32 Reconciliation (io.strimzi.operator.common.Reconciliation)26 Checkpoint (io.vertx.junit5.Checkpoint)26 VertxExtension (io.vertx.junit5.VertxExtension)26 VertxTestContext (io.vertx.junit5.VertxTestContext)26 AfterAll (org.junit.jupiter.api.AfterAll)26 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)26 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)25