Search in sources :

Example 41 with Reconciliation

use of io.strimzi.operator.common.Reconciliation in project strimzi by strimzi.

the class VolumeResizingTest method testVolumesResized.

@Test
public void testVolumesResized() {
    Kafka kafka = getKafkaCrd();
    KafkaCluster kafkaCluster = KafkaCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, VERSIONS);
    ResourceOperatorSupplier supplier = ResourceUtils.supplierWithMocks(false);
    // Mock the PVC Operator
    PvcOperator mockPvcOps = supplier.pvcOperations;
    List<PersistentVolumeClaim> realPvcs = kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage());
    for (PersistentVolumeClaim pvc : realPvcs) {
        pvc.setStatus(new PersistentVolumeClaimStatusBuilder().withPhase("Bound").withCapacity(singletonMap("storage", new Quantity("20Gi"))).build());
    }
    when(mockPvcOps.getAsync(eq(namespace), ArgumentMatchers.startsWith("data-"))).thenAnswer(invocation -> {
        String pvcName = invocation.getArgument(1);
        return Future.succeededFuture(realPvcs.stream().filter(pvc -> pvcName.equals(pvc.getMetadata().getName())).findFirst().orElse(null));
    });
    ArgumentCaptor<PersistentVolumeClaim> pvcCaptor = ArgumentCaptor.forClass(PersistentVolumeClaim.class);
    when(mockPvcOps.reconcile(any(), anyString(), anyString(), pvcCaptor.capture())).thenReturn(Future.succeededFuture());
    // Mock the StorageClass Operator
    StorageClassOperator mockSco = supplier.storageClassOperations;
    when(mockSco.getAsync(eq("mysc"))).thenAnswer(invocation -> {
        StorageClass sc = new StorageClassBuilder().withNewMetadata().withName("mysc").endMetadata().withAllowVolumeExpansion(true).build();
        return Future.succeededFuture(sc);
    });
    MockKafkaAssemblyOperator kao = new MockKafkaAssemblyOperator(vertx, new PlatformFeaturesAvailability(false, kubernetesVersion), certManager, passwordGenerator, supplier, config);
    kao.resizeVolumes(new Reconciliation("test-trigger", Kafka.RESOURCE_KIND, namespace, clusterName), kafka, kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage()), kafkaCluster).onComplete(res -> {
        assertThat(res.succeeded(), is(true));
        assertThat(pvcCaptor.getAllValues().size(), is(3));
        assertThat(pvcCaptor.getAllValues(), is(kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage())));
    });
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) CoreMatchers.is(org.hamcrest.CoreMatchers.is) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ArgumentMatchers(org.mockito.ArgumentMatchers) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) CertManager(io.strimzi.certs.CertManager) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) PersistentVolumeClaimConditionBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimConditionBuilder) AfterAll(org.junit.jupiter.api.AfterAll) ArgumentCaptor(org.mockito.ArgumentCaptor) KafkaCluster(io.strimzi.operator.cluster.model.KafkaCluster) KafkaVersionTestUtils(io.strimzi.operator.cluster.KafkaVersionTestUtils) BeforeAll(org.junit.jupiter.api.BeforeAll) PersistentVolumeClaimStatusBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimStatusBuilder) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) Collections.singletonMap(java.util.Collections.singletonMap) ResourceUtils(io.strimzi.operator.cluster.ResourceUtils) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) KafkaVersion(io.strimzi.operator.cluster.model.KafkaVersion) KubernetesVersion(io.strimzi.operator.KubernetesVersion) Vertx(io.vertx.core.Vertx) StorageClassOperator(io.strimzi.operator.common.operator.resource.StorageClassOperator) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) Mockito.when(org.mockito.Mockito.when) PvcOperator(io.strimzi.operator.common.operator.resource.PvcOperator) Future(io.vertx.core.Future) StorageClassBuilder(io.fabric8.kubernetes.api.model.storage.StorageClassBuilder) Test(org.junit.jupiter.api.Test) Reconciliation(io.strimzi.operator.common.Reconciliation) List(java.util.List) StorageClass(io.fabric8.kubernetes.api.model.storage.StorageClass) KafkaListenerType(io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType) PasswordGenerator(io.strimzi.operator.common.PasswordGenerator) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) Kafka(io.strimzi.api.kafka.model.Kafka) PlatformFeaturesAvailability(io.strimzi.operator.PlatformFeaturesAvailability) ClusterOperatorConfig(io.strimzi.operator.cluster.ClusterOperatorConfig) MockCertManager(io.strimzi.operator.common.operator.MockCertManager) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) PersistentVolumeClaimStatusBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimStatusBuilder) KafkaCluster(io.strimzi.operator.cluster.model.KafkaCluster) StorageClassOperator(io.strimzi.operator.common.operator.resource.StorageClassOperator) StorageClass(io.fabric8.kubernetes.api.model.storage.StorageClass) Kafka(io.strimzi.api.kafka.model.Kafka) Quantity(io.fabric8.kubernetes.api.model.Quantity) StorageClassBuilder(io.fabric8.kubernetes.api.model.storage.StorageClassBuilder) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) PvcOperator(io.strimzi.operator.common.operator.resource.PvcOperator) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) PlatformFeaturesAvailability(io.strimzi.operator.PlatformFeaturesAvailability) Reconciliation(io.strimzi.operator.common.Reconciliation) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) Test(org.junit.jupiter.api.Test)

Example 42 with Reconciliation

use of io.strimzi.operator.common.Reconciliation in project strimzi by strimzi.

the class VolumeResizingTest method testNoExistingVolumes.

@Test
public void testNoExistingVolumes() {
    Kafka kafka = getKafkaCrd();
    KafkaCluster kafkaCluster = KafkaCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, VERSIONS);
    ResourceOperatorSupplier supplier = ResourceUtils.supplierWithMocks(false);
    // Mock the PVC Operator
    PvcOperator mockPvcOps = supplier.pvcOperations;
    when(mockPvcOps.getAsync(eq(namespace), ArgumentMatchers.startsWith("data-"))).thenReturn(Future.succeededFuture());
    ArgumentCaptor<PersistentVolumeClaim> pvcCaptor = ArgumentCaptor.forClass(PersistentVolumeClaim.class);
    when(mockPvcOps.reconcile(any(), anyString(), anyString(), pvcCaptor.capture())).thenReturn(Future.succeededFuture());
    // Mock the StorageClass Operator
    StorageClassOperator mockSco = supplier.storageClassOperations;
    when(mockSco.getAsync(eq("mysc"))).thenAnswer(invocation -> {
        StorageClass sc = new StorageClassBuilder().withNewMetadata().withName("mysc").endMetadata().withAllowVolumeExpansion(true).build();
        return Future.succeededFuture(sc);
    });
    MockKafkaAssemblyOperator kao = new MockKafkaAssemblyOperator(vertx, new PlatformFeaturesAvailability(false, kubernetesVersion), certManager, passwordGenerator, supplier, config);
    kao.resizeVolumes(new Reconciliation("test-trigger", Kafka.RESOURCE_KIND, namespace, clusterName), kafka, kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage()), kafkaCluster).onComplete(res -> {
        assertThat(res.succeeded(), is(true));
        assertThat(pvcCaptor.getAllValues().size(), is(3));
        assertThat(pvcCaptor.getAllValues(), is(kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage())));
    });
}
Also used : ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) KafkaCluster(io.strimzi.operator.cluster.model.KafkaCluster) StorageClassOperator(io.strimzi.operator.common.operator.resource.StorageClassOperator) PlatformFeaturesAvailability(io.strimzi.operator.PlatformFeaturesAvailability) StorageClass(io.fabric8.kubernetes.api.model.storage.StorageClass) Reconciliation(io.strimzi.operator.common.Reconciliation) Kafka(io.strimzi.api.kafka.model.Kafka) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) StorageClassBuilder(io.fabric8.kubernetes.api.model.storage.StorageClassBuilder) PvcOperator(io.strimzi.operator.common.operator.resource.PvcOperator) Test(org.junit.jupiter.api.Test)

Example 43 with Reconciliation

use of io.strimzi.operator.common.Reconciliation in project strimzi by strimzi.

the class VolumeResizingTest method testVolumesResizing.

@Test
public void testVolumesResizing() {
    Kafka kafka = getKafkaCrd();
    KafkaCluster kafkaCluster = KafkaCluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, kafka, VERSIONS);
    ResourceOperatorSupplier supplier = ResourceUtils.supplierWithMocks(false);
    // Mock the PVC Operator
    PvcOperator mockPvcOps = supplier.pvcOperations;
    List<PersistentVolumeClaim> realPvcs = kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage());
    for (PersistentVolumeClaim pvc : realPvcs) {
        pvc.setStatus(new PersistentVolumeClaimStatusBuilder().withPhase("Bound").withConditions(new PersistentVolumeClaimConditionBuilder().withStatus("True").withType("Resizing").build()).withCapacity(singletonMap("storage", new Quantity("10Gi"))).build());
    }
    when(mockPvcOps.getAsync(eq(namespace), ArgumentMatchers.startsWith("data-"))).thenAnswer(invocation -> {
        String pvcName = invocation.getArgument(1);
        return Future.succeededFuture(realPvcs.stream().filter(pvc -> pvcName.equals(pvc.getMetadata().getName())).findFirst().orElse(null));
    });
    ArgumentCaptor<PersistentVolumeClaim> pvcCaptor = ArgumentCaptor.forClass(PersistentVolumeClaim.class);
    when(mockPvcOps.reconcile(any(), anyString(), anyString(), pvcCaptor.capture())).thenReturn(Future.succeededFuture());
    // Mock the StorageClass Operator
    StorageClassOperator mockSco = supplier.storageClassOperations;
    when(mockSco.getAsync(eq("mysc"))).thenAnswer(invocation -> {
        StorageClass sc = new StorageClassBuilder().withNewMetadata().withName("mysc").endMetadata().withAllowVolumeExpansion(true).build();
        return Future.succeededFuture(sc);
    });
    MockKafkaAssemblyOperator kao = new MockKafkaAssemblyOperator(vertx, new PlatformFeaturesAvailability(false, kubernetesVersion), certManager, passwordGenerator, supplier, config);
    kao.resizeVolumes(new Reconciliation("test-trigger", Kafka.RESOURCE_KIND, namespace, clusterName), kafka, kafkaCluster.generatePersistentVolumeClaims(kafka.getSpec().getKafka().getStorage()), kafkaCluster).onComplete(res -> {
        assertThat(res.succeeded(), is(true));
        // The volumes are resizing => no reconciliation
        assertThat(pvcCaptor.getAllValues().size(), is(0));
    });
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) CoreMatchers.is(org.hamcrest.CoreMatchers.is) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) ArgumentMatchers(org.mockito.ArgumentMatchers) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) CertManager(io.strimzi.certs.CertManager) KafkaBuilder(io.strimzi.api.kafka.model.KafkaBuilder) PersistentVolumeClaimConditionBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimConditionBuilder) AfterAll(org.junit.jupiter.api.AfterAll) ArgumentCaptor(org.mockito.ArgumentCaptor) KafkaCluster(io.strimzi.operator.cluster.model.KafkaCluster) KafkaVersionTestUtils(io.strimzi.operator.cluster.KafkaVersionTestUtils) BeforeAll(org.junit.jupiter.api.BeforeAll) PersistentVolumeClaimStatusBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimStatusBuilder) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) Collections.singletonMap(java.util.Collections.singletonMap) ResourceUtils(io.strimzi.operator.cluster.ResourceUtils) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) KafkaVersion(io.strimzi.operator.cluster.model.KafkaVersion) KubernetesVersion(io.strimzi.operator.KubernetesVersion) Vertx(io.vertx.core.Vertx) StorageClassOperator(io.strimzi.operator.common.operator.resource.StorageClassOperator) GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) Mockito.when(org.mockito.Mockito.when) PvcOperator(io.strimzi.operator.common.operator.resource.PvcOperator) Future(io.vertx.core.Future) StorageClassBuilder(io.fabric8.kubernetes.api.model.storage.StorageClassBuilder) Test(org.junit.jupiter.api.Test) Reconciliation(io.strimzi.operator.common.Reconciliation) List(java.util.List) StorageClass(io.fabric8.kubernetes.api.model.storage.StorageClass) KafkaListenerType(io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType) PasswordGenerator(io.strimzi.operator.common.PasswordGenerator) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) Kafka(io.strimzi.api.kafka.model.Kafka) PlatformFeaturesAvailability(io.strimzi.operator.PlatformFeaturesAvailability) ClusterOperatorConfig(io.strimzi.operator.cluster.ClusterOperatorConfig) MockCertManager(io.strimzi.operator.common.operator.MockCertManager) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) PersistentVolumeClaimStatusBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimStatusBuilder) KafkaCluster(io.strimzi.operator.cluster.model.KafkaCluster) StorageClassOperator(io.strimzi.operator.common.operator.resource.StorageClassOperator) StorageClass(io.fabric8.kubernetes.api.model.storage.StorageClass) Kafka(io.strimzi.api.kafka.model.Kafka) Quantity(io.fabric8.kubernetes.api.model.Quantity) StorageClassBuilder(io.fabric8.kubernetes.api.model.storage.StorageClassBuilder) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) PvcOperator(io.strimzi.operator.common.operator.resource.PvcOperator) PersistentVolumeClaimConditionBuilder(io.fabric8.kubernetes.api.model.PersistentVolumeClaimConditionBuilder) ResourceOperatorSupplier(io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier) PlatformFeaturesAvailability(io.strimzi.operator.PlatformFeaturesAvailability) Reconciliation(io.strimzi.operator.common.Reconciliation) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) Test(org.junit.jupiter.api.Test)

Example 44 with Reconciliation

use of io.strimzi.operator.common.Reconciliation in project strimzi by strimzi.

the class MultipleClusterOperatorsIsolatedST method testKafkaCCAndRebalanceWithMultipleCOs.

@IsolatedTest
@Tag(CRUISE_CONTROL)
void testKafkaCCAndRebalanceWithMultipleCOs(ExtensionContext extensionContext) {
    String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    LabelSelector kafkaSelector = KafkaResource.getLabelSelector(clusterName, KafkaResources.kafkaStatefulSetName(clusterName));
    int scaleTo = 4;
    deployCOInNamespace(extensionContext, FIRST_CO_NAME, DEFAULT_NAMESPACE, FIRST_CO_SELECTOR_ENV, false);
    deployCOInNamespace(extensionContext, SECOND_CO_NAME, DEFAULT_NAMESPACE, SECOND_CO_SELECTOR_ENV, false);
    LOGGER.info("Deploying Kafka with {} selector of {}", FIRST_CO_SELECTOR, FIRST_CO_NAME);
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaWithCruiseControl(clusterName, 3, 3).editOrNewMetadata().addToLabels(FIRST_CO_SELECTOR).withNamespace(DEFAULT_NAMESPACE).endMetadata().build());
    LOGGER.info("Removing CR selector from Kafka and increasing number of replicas to 4, new pod should not appear");
    KafkaResource.replaceKafkaResourceInSpecificNamespace(clusterName, kafka -> {
        kafka.getMetadata().getLabels().clear();
        kafka.getSpec().getKafka().setReplicas(scaleTo);
    }, DEFAULT_NAMESPACE);
    // because KafkaRebalance is pointing to Kafka with CC cluster, we need to create KR before adding the label back
    // to test if KR will be ignored
    LOGGER.info("Creating KafkaRebalance when CC doesn't have label for CO, the KR should be ignored");
    resourceManager.createResource(extensionContext, false, KafkaRebalanceTemplates.kafkaRebalance(clusterName).editMetadata().withNamespace(DEFAULT_NAMESPACE).endMetadata().editSpec().withGoals("DiskCapacityGoal", "CpuCapacityGoal", "NetworkInboundCapacityGoal", "MinTopicLeadersPerBrokerGoal", "NetworkOutboundCapacityGoal", "ReplicaCapacityGoal").withSkipHardGoalCheck(true).endSpec().build());
    KafkaUtils.waitForClusterStability(DEFAULT_NAMESPACE, clusterName);
    LOGGER.info("Checking if KafkaRebalance is still ignored, after the cluster stability wait");
    // because KR is ignored, it shouldn't contain any status
    assertNull(KafkaRebalanceResource.kafkaRebalanceClient().inNamespace(DEFAULT_NAMESPACE).withName(clusterName).get().getStatus());
    LOGGER.info("Adding {} selector of {} to Kafka", SECOND_CO_SELECTOR, SECOND_CO_NAME);
    KafkaResource.replaceKafkaResourceInSpecificNamespace(clusterName, kafka -> kafka.getMetadata().setLabels(SECOND_CO_SELECTOR), DEFAULT_NAMESPACE);
    LOGGER.info("Waiting for Kafka to scales pods to {}", scaleTo);
    RollingUpdateUtils.waitForComponentAndPodsReady(DEFAULT_NAMESPACE, kafkaSelector, scaleTo);
    assertThat(PodUtils.podSnapshot(DEFAULT_NAMESPACE, kafkaSelector).size(), is(scaleTo));
    KafkaRebalanceUtils.doRebalancingProcess(new Reconciliation("test", KafkaRebalance.RESOURCE_KIND, SECOND_NAMESPACE, clusterName), DEFAULT_NAMESPACE, clusterName);
}
Also used : Reconciliation(io.strimzi.operator.common.Reconciliation) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest) Tag(org.junit.jupiter.api.Tag)

Example 45 with Reconciliation

use of io.strimzi.operator.common.Reconciliation in project strimzi by strimzi.

the class TopicOperatorTest method testReconcileMetricsWithPausedTopic.

@Test
public void testReconcileMetricsWithPausedTopic(VertxTestContext context) throws InterruptedException {
    mockKafka.setTopicsListResponse(Future.succeededFuture(emptySet()));
    mockKafka.setUpdateTopicResponse(topicName -> Future.succeededFuture());
    metadata.getAnnotations().put("strimzi.io/pause-reconciliation", "false");
    resourceAdded(context, null, null, null);
    Future<?> reconcileFuture = topicOperator.reconcileAllTopics("periodic");
    // workaround for the vertx junit5 integration
    CountDownLatch latch = new CountDownLatch(2);
    CountDownLatch splitLatch = new CountDownLatch(1);
    reconcileFuture.onComplete(context.succeeding(e -> context.verify(() -> {
        MeterRegistry registry = metrics.meterRegistry();
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations").tag("kind", "KafkaTopic").counter().count(), is(1.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "resources.paused").tag("kind", "KafkaTopic").gauge().value(), is(0.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.successful").tag("kind", "KafkaTopic").counter().count(), is(1.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.failed").tag("kind", "KafkaTopic").counter().count(), is(0.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.duration").tag("kind", "KafkaTopic").timer().count(), is(1L));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.duration").tag("kind", "KafkaTopic").timer().totalTime(TimeUnit.MILLISECONDS), greaterThan(0.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "resource.state").tag("kind", "KafkaTopic").tag("name", topicName.toString()).tag("resource-namespace", "default-namespace").gauge().value(), is(1.0));
        latch.countDown();
        splitLatch.countDown();
    })));
    splitLatch.await(10_000, TimeUnit.MILLISECONDS);
    metadata.getAnnotations().put("strimzi.io/pause-reconciliation", "true");
    resourceAdded(context, null, null, null);
    topicOperator.reconcileAllTopics("periodic").onComplete(context.succeeding(f -> context.verify(() -> {
        MeterRegistry registry = metrics.meterRegistry();
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations").tag("kind", "KafkaTopic").counter().count(), is(2.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "resources.paused").tag("kind", "KafkaTopic").gauge().value(), is(1.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.successful").tag("kind", "KafkaTopic").counter().count(), is(2.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.failed").tag("kind", "KafkaTopic").counter().count(), is(0.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.duration").tag("kind", "KafkaTopic").timer().count(), is(2L));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "reconciliations.duration").tag("kind", "KafkaTopic").timer().totalTime(TimeUnit.MILLISECONDS), greaterThan(0.0));
        assertThat(registry.get(TopicOperator.METRICS_PREFIX + "resource.state").tag("kind", "KafkaTopic").tag("name", topicName.toString()).tag("resource-namespace", "default-namespace").gauge().value(), is(1.0));
        latch.countDown();
    })));
    assertThat(latch.await(10_000, TimeUnit.MILLISECONDS), is(true));
    context.completeNow();
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) BeforeEach(org.junit.jupiter.api.BeforeEach) Watcher(io.fabric8.kubernetes.client.Watcher) MaxAttemptsExceededException(io.strimzi.operator.common.MaxAttemptsExceededException) ClusterAuthorizationException(org.apache.kafka.common.errors.ClusterAuthorizationException) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) AfterAll(org.junit.jupiter.api.AfterAll) CoreMatchers.instanceOf(org.hamcrest.CoreMatchers.instanceOf) MicrometerMetricsOptions(io.vertx.micrometer.MicrometerMetricsOptions) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Collections.singleton(java.util.Collections.singleton) BeforeAll(org.junit.jupiter.api.BeforeAll) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException) KafkaTopicStatus(io.strimzi.api.kafka.model.status.KafkaTopicStatus) ADDED(io.fabric8.kubernetes.client.Watcher.Action.ADDED) DELETED(io.fabric8.kubernetes.client.Watcher.Action.DELETED) MetricsProvider(io.strimzi.operator.common.MetricsProvider) VertxOptions(io.vertx.core.VertxOptions) VertxPrometheusOptions(io.vertx.micrometer.VertxPrometheusOptions) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Test(org.junit.jupiter.api.Test) Objects(java.util.Objects) CountDownLatch(java.util.concurrent.CountDownLatch) TopicExistsException(org.apache.kafka.common.errors.TopicExistsException) List(java.util.List) ObjectMeta(io.fabric8.kubernetes.api.model.ObjectMeta) KafkaTopicBuilder(io.strimzi.api.kafka.model.KafkaTopicBuilder) TopicDeletionDisabledException(org.apache.kafka.common.errors.TopicDeletionDisabledException) Checkpoint(io.vertx.junit5.Checkpoint) UnknownTopicOrPartitionException(org.apache.kafka.common.errors.UnknownTopicOrPartitionException) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) VertxTestContext(io.vertx.junit5.VertxTestContext) HashMap(java.util.HashMap) MODIFIED(io.fabric8.kubernetes.client.Watcher.Action.MODIFIED) Collections.singletonMap(java.util.Collections.singletonMap) AsyncResult(io.vertx.core.AsyncResult) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ObjectMetaBuilder(io.fabric8.kubernetes.api.model.ObjectMetaBuilder) Collections.emptySet(java.util.Collections.emptySet) MicrometerMetricsProvider(io.strimzi.operator.common.MicrometerMetricsProvider) Vertx(io.vertx.core.Vertx) TimeUnit(java.util.concurrent.TimeUnit) Reconciliation(io.strimzi.operator.common.Reconciliation) AfterEach(org.junit.jupiter.api.AfterEach) KafkaTopic(io.strimzi.api.kafka.model.KafkaTopic) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) Collections(java.util.Collections) CountDownLatch(java.util.concurrent.CountDownLatch) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) Test(org.junit.jupiter.api.Test)

Aggregations

Reconciliation (io.strimzi.operator.common.Reconciliation)748 Checkpoint (io.vertx.junit5.Checkpoint)504 Test (org.junit.jupiter.api.Test)496 Future (io.vertx.core.Future)478 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)474 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)462 Vertx (io.vertx.core.Vertx)450 VertxTestContext (io.vertx.junit5.VertxTestContext)446 VertxExtension (io.vertx.junit5.VertxExtension)436 List (java.util.List)436 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)436 Map (java.util.Map)426 AfterAll (org.junit.jupiter.api.AfterAll)406 BeforeAll (org.junit.jupiter.api.BeforeAll)394 Kafka (io.strimzi.api.kafka.model.Kafka)392 PlatformFeaturesAvailability (io.strimzi.operator.PlatformFeaturesAvailability)392 ResourceUtils (io.strimzi.operator.cluster.ResourceUtils)390 CoreMatchers.is (org.hamcrest.CoreMatchers.is)380 KafkaVersionTestUtils (io.strimzi.operator.cluster.KafkaVersionTestUtils)368 Mockito.when (org.mockito.Mockito.when)360