KafkaSpecChecker { private void checkZooKeeperReplicas(List<Condition> warnings) { if (zkCluster.getReplicas() == 2) { warnings.add(StatusUtils.buildWarningCondition("ZooKeeperReplicas", "Running ZooKeeper with two nodes is not advisable as both replicas will be needed to avoid downtime. It is recommended that a minimum of three replicas are used.")); } else if (zkCluster.getReplicas() % 2 == 0) { warnings.add(StatusUtils.buildWarningCondition("ZooKeeperReplicas", "Running ZooKeeper with an odd number of replicas is recommended.")); } } KafkaSpecChecker(KafkaSpec spec, KafkaCluster kafkaCluster, ZookeeperCluster zkCluster); List<Condition> run();  }
@Test public void checkZookeeperReplicas() { Kafka kafka = ResourceUtils.createKafka(NAMESPACE, NAME, 2, IMAGE, HEALTH_DELAY, HEALTH_TIMEOUT); KafkaSpecChecker checker = generateChecker(kafka); List<Condition> warnings = checker.run(); assertThat(warnings, hasSize(1)); Condition warning = warnings.get(0); assertThat(warning.getReason(), is("ZooKeeperReplicas")); assertThat(warning.getStatus(), is("True")); assertThat(warning.getMessage(), is("Running ZooKeeper with two nodes is not advisable as both replicas will be needed to avoid downtime. It is recommended that a minimum of three replicas are used.")); }