use of io.strimzi.api.kafka.model.status.KafkaTopicStatus in project strimzi-kafka-operator by strimzi.
the class CustomResourceStatusIsolatedST method assertKafkaTopicStatus.
void assertKafkaTopicStatus(long expectedObservedGeneration, String topicName) {
KafkaTopicStatus kafkaTopicStatus = KafkaTopicResource.kafkaTopicClient().inNamespace(clusterOperator.getDeploymentNamespace()).withName(topicName).get().getStatus();
assertThat("KafkaTopic status has incorrect Observed Generation", kafkaTopicStatus.getObservedGeneration(), is(expectedObservedGeneration));
}
use of io.strimzi.api.kafka.model.status.KafkaTopicStatus in project strimzi-kafka-operator by strimzi.
the class TopicOperatorBaseIT method assertStatusNotReady.
protected void assertStatusNotReady(String topicName, Class<? extends Exception> reason, String message) throws InterruptedException, ExecutionException, TimeoutException {
waitFor(() -> {
KafkaTopic kafkaTopic = operation().inNamespace(NAMESPACE).withName(topicName).get();
if (kafkaTopic != null) {
KafkaTopicStatus status = kafkaTopic.getStatus();
if (status != null && Objects.equals(status.getObservedGeneration(), kafkaTopic.getMetadata().getGeneration()) && status.getConditions() != null) {
List<Condition> conditions = status.getConditions();
assertThat(conditions.size() > 0, is(true));
Optional<Condition> unreadyCondition = conditions.stream().filter(condition -> "NotReady".equals(condition.getType()) && "True".equals(condition.getStatus())).findFirst();
if (unreadyCondition.isPresent()) {
if (reason != null) {
assertThat(unreadyCondition.get().getReason() + ": " + unreadyCondition.get().getMessage(), is(reason.getSimpleName() + ": " + message));
} else {
assertThat(unreadyCondition.get().getMessage(), is(message));
}
return true;
} else {
LOGGER.info(conditions);
}
}
} else {
LOGGER.info("{} does not exist", topicName);
}
return false;
}, "status ready");
}
Aggregations