Search in sources :

Example 11 with Condition

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

the class KafkaSpecCheckerTest method checkInterBrokerProtocolVersion.

@Test
public void checkInterBrokerProtocolVersion() {
    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 = new KafkaBuilder(ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null)).editSpec().editKafka().withVersion(KafkaVersionTestUtils.LATEST_KAFKA_VERSION).withListeners(new GenericKafkaListenerBuilder().withName("plain").withPort(9092).withTls(false).withType(KafkaListenerType.INTERNAL).build()).endKafka().endSpec().build();
    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) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 12 with Condition

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

the class KafkaSpecCheckerTest method checkZookeeperStorage.

@Test
public void checkZookeeperStorage() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.DEFAULT_REPLICATION_FACTOR, 3);
    kafkaOptions.put(KafkaConfiguration.MIN_INSYNC_REPLICAS, 2);
    Kafka kafka = new KafkaBuilder(ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, null, kafkaOptions, emptyMap(), new EphemeralStorage(), new EphemeralStorage(), null, null, null, null)).editSpec().editZookeeper().withReplicas(1).endZookeeper().endSpec().build();
    KafkaSpecChecker checker = generateChecker(kafka);
    List<Condition> warnings = checker.run();
    assertThat(warnings, hasSize(1));
    Condition warning = warnings.get(0);
    assertThat(warning.getReason(), is("ZooKeeperStorage"));
    assertThat(warning.getStatus(), is("True"));
    assertThat(warning.getMessage(), is("A ZooKeeper cluster with a single replica and ephemeral storage will be in a defective state after any restart or rolling update. It is recommended that a minimum of three replicas are used."));
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) HashMap(java.util.HashMap) Kafka(io.strimzi.api.kafka.model.Kafka) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) EphemeralStorage(io.strimzi.api.kafka.model.storage.EphemeralStorage) Test(org.junit.jupiter.api.Test)

Example 13 with Condition

use of io.strimzi.api.kafka.model.status.Condition in project strimzi 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 14 with Condition

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

the class KafkaSpecCheckerTest method checkLogMessageFormatWithRightLongVersion.

@Test
public void checkLogMessageFormatWithRightLongVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.LOG_MESSAGE_FORMAT_VERSION, KafkaVersionTestUtils.LATEST_FORMAT_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 15 with Condition

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

the class KafkaSpecCheckerTest method checkLogMessageFormatWithoutVersion.

@Test
public void checkLogMessageFormatWithoutVersion() {
    Map<String, Object> kafkaOptions = new HashMap<>();
    kafkaOptions.put(KafkaConfiguration.LOG_MESSAGE_FORMAT_VERSION, KafkaVersionTestUtils.PREVIOUS_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(1));
    Condition warning = warnings.get(0);
    assertThat(warning.getReason(), is("KafkaLogMessageFormatVersion"));
    assertThat(warning.getStatus(), is("True"));
    assertThat(warning.getMessage(), is("log.message.format.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)132 Test (org.junit.jupiter.api.Test)58 Kafka (io.strimzi.api.kafka.model.Kafka)46 HashMap (java.util.HashMap)41 EphemeralStorage (io.strimzi.api.kafka.model.storage.EphemeralStorage)36 Collections (java.util.Collections)32 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)32 Vertx (io.vertx.core.Vertx)28 Map (java.util.Map)27 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)26 Labels (io.strimzi.operator.common.model.Labels)26 Future (io.vertx.core.Future)26 BeforeAll (org.junit.jupiter.api.BeforeAll)26 CoreMatchers.is (org.hamcrest.CoreMatchers.is)24 Promise (io.vertx.core.Promise)20 Checkpoint (io.vertx.junit5.Checkpoint)20 VertxExtension (io.vertx.junit5.VertxExtension)20 VertxTestContext (io.vertx.junit5.VertxTestContext)20 List (java.util.List)20 AfterAll (org.junit.jupiter.api.AfterAll)20