KafkaSpecChecker { private void checkZooKeeperStorage(List<Condition> warnings) { if (zkCluster.getReplicas() == 1 && StorageUtils.usesEphemeral(zkCluster.getStorage())) { warnings.add(StatusUtils.buildWarningCondition("ZooKeeperStorage", "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.")); } } KafkaSpecChecker(KafkaSpec spec, KafkaCluster kafkaCluster, ZookeeperCluster zkCluster); List<Condition> run();  }
@Test public void checkZookeeperStorage() { Kafka kafka = new KafkaBuilder(ResourceUtils.createKafka(NAMESPACE, NAME, 3, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT, Collections.emptyMap(), Collections.emptyMap(), Collections.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.")); }