Search in sources :

Example 6 with OperandReadiness

use of org.bf2.operator.operands.OperandReadiness in project kas-fleetshard by bf2fc6cc711aee1a0c2a.

the class KafkaClusterTest method pausedUnknownStatus.

@Test
void pausedUnknownStatus() throws InterruptedException {
    ManagedKafka mk = ManagedKafka.getDummyInstance(1);
    InformerManager informer = Mockito.mock(InformerManager.class);
    Kafka kafka = new KafkaBuilder(this.kafkaCluster.kafkaFrom(mk, null)).editMetadata().withAnnotations(Map.of(StrimziManager.STRIMZI_PAUSE_REASON_ANNOTATION, "custom")).endMetadata().withNewStatus().withConditions(new ConditionBuilder().withType("ReconciliationPaused").withStatus("True").build()).endStatus().build();
    Mockito.when(informer.getLocalKafka(Mockito.anyString(), Mockito.anyString())).thenReturn(kafka);
    QuarkusMock.installMockForType(informer, InformerManager.class);
    OperandReadiness readiness = this.kafkaCluster.getReadiness(mk);
    assertEquals(Status.Unknown, readiness.getStatus());
    assertEquals(Reason.Paused, readiness.getReason());
    assertEquals("Kafka mk-1 is paused for an unknown reason", readiness.getMessage());
}
Also used : ConditionBuilder(io.strimzi.api.kafka.model.status.ConditionBuilder) ManagedKafkaUtils.exampleManagedKafka(org.bf2.operator.utils.ManagedKafkaUtils.exampleManagedKafka) ManagedKafka(org.bf2.operator.resources.v1alpha1.ManagedKafka) ManagedKafkaUtils.exampleManagedKafka(org.bf2.operator.utils.ManagedKafkaUtils.exampleManagedKafka) Kafka(io.strimzi.api.kafka.model.Kafka) ManagedKafka(org.bf2.operator.resources.v1alpha1.ManagedKafka) InformerManager(org.bf2.operator.managers.InformerManager) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ManagedKafka (org.bf2.operator.resources.v1alpha1.ManagedKafka)5 Context (io.javaoperatorsdk.operator.api.Context)3 List (java.util.List)3 Objects (java.util.Objects)3 Inject (javax.inject.Inject)3 Reason (org.bf2.operator.resources.v1alpha1.ManagedKafkaCondition.Reason)3 Status (org.bf2.operator.resources.v1alpha1.ManagedKafkaCondition.Status)3 QuarkusTest (io.quarkus.test.junit.QuarkusTest)2 Kafka (io.strimzi.api.kafka.model.Kafka)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Optional (java.util.Optional)2 OperandReadiness (org.bf2.operator.operands.OperandReadiness)2 StrimziVersionStatus (org.bf2.operator.resources.v1alpha1.StrimziVersionStatus)2 Pod (io.fabric8.kubernetes.api.model.Pod)1 Quantity (io.fabric8.kubernetes.api.model.Quantity)1 NetworkPolicyPeerBuilder (io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicyPeerBuilder)1 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)1 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)1 Controller (io.javaoperatorsdk.operator.api.Controller)1