Search in sources :

Example 26 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.

the class CustomResourceStatusIsolatedST method testKafkaUserStatus.

@ParallelTest
void testKafkaUserStatus(ExtensionContext extensionContext) {
    String userName = mapWithTestUsers.get(extensionContext.getDisplayName());
    resourceManager.createResource(extensionContext, KafkaUserTemplates.tlsUser(Constants.INFRA_NAMESPACE, CUSTOM_RESOURCE_STATUS_CLUSTER_NAME, userName).build());
    LOGGER.info("Checking status of deployed KafkaUser");
    Condition kafkaCondition = KafkaUserResource.kafkaUserClient().inNamespace(Constants.INFRA_NAMESPACE).withName(userName).get().getStatus().getConditions().get(0);
    LOGGER.info("KafkaUser Status: {}", kafkaCondition.getStatus());
    LOGGER.info("KafkaUser Type: {}", kafkaCondition.getType());
    assertThat("KafkaUser is in wrong state!", kafkaCondition.getType(), is(Ready.toString()));
    LOGGER.info("KafkaUser is in desired state: Ready");
}
Also used : Condition(io.strimzi.api.kafka.model.status.Condition) StringContains.containsString(org.hamcrest.core.StringContains.containsString) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Example 27 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.

the class CustomResourceStatusIsolatedST method testKafkaMirrorMaker2Status.

@ParallelTest
@Tag(MIRROR_MAKER2)
@Tag(CONNECT_COMPONENTS)
void testKafkaMirrorMaker2Status(ExtensionContext extensionContext) {
    String targetClusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    String mirrorMaker2Name = targetClusterName + "-mirror-maker-2";
    String mm2Url = KafkaMirrorMaker2Resources.url(mirrorMaker2Name, Constants.INFRA_NAMESPACE, 8083);
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(targetClusterName, 1, 1).editMetadata().withNamespace(Constants.INFRA_NAMESPACE).endMetadata().build());
    resourceManager.createResource(extensionContext, KafkaMirrorMaker2Templates.kafkaMirrorMaker2(mirrorMaker2Name, CUSTOM_RESOURCE_STATUS_CLUSTER_NAME, targetClusterName, 1, false).editMetadata().withNamespace(Constants.INFRA_NAMESPACE).endMetadata().build());
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2Ready(Constants.INFRA_NAMESPACE, mirrorMaker2Name);
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2ConnectorReadiness(Constants.INFRA_NAMESPACE, mirrorMaker2Name);
    assertKafkaMirrorMaker2Status(1, mm2Url, mirrorMaker2Name);
    // Corrupt Mirror Maker pods
    KafkaMirrorMaker2Resource.replaceKafkaMirrorMaker2ResourceInSpecificNamespace(mirrorMaker2Name, mm2 -> mm2.getSpec().setResources(new ResourceRequirementsBuilder().addToRequests("cpu", new Quantity("100000000m")).build()), Constants.INFRA_NAMESPACE);
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2NotReady(Constants.INFRA_NAMESPACE, mirrorMaker2Name);
    // Restore Mirror Maker pod
    KafkaMirrorMaker2Resource.replaceKafkaMirrorMaker2ResourceInSpecificNamespace(mirrorMaker2Name, mm2 -> mm2.getSpec().setResources(new ResourceRequirementsBuilder().addToRequests("cpu", new Quantity("100m")).build()), Constants.INFRA_NAMESPACE);
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2Ready(Constants.INFRA_NAMESPACE, mirrorMaker2Name);
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2ConnectorReadiness(Constants.INFRA_NAMESPACE, mirrorMaker2Name);
    assertKafkaMirrorMaker2Status(3, mm2Url, mirrorMaker2Name);
    // Wait for pods stability and check that pods weren't rolled
    PodUtils.verifyThatRunningPodsAreStable(Constants.INFRA_NAMESPACE, KafkaMirrorMaker2Resources.deploymentName(mirrorMaker2Name));
    assertKafkaMirrorMaker2Status(3, mm2Url, mirrorMaker2Name);
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2ConnectorReadiness(Constants.INFRA_NAMESPACE, mirrorMaker2Name);
}
Also used : ResourceRequirementsBuilder(io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder) Quantity(io.fabric8.kubernetes.api.model.Quantity) StringContains.containsString(org.hamcrest.core.StringContains.containsString) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest) Tag(org.junit.jupiter.api.Tag)

Example 28 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.

the class CustomResourceStatusIsolatedST method testKafkaMirrorMaker2WrongBootstrap.

@ParallelTest
@Tag(MIRROR_MAKER2)
void testKafkaMirrorMaker2WrongBootstrap(ExtensionContext extensionContext) {
    String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    String mirrorMaker2Name = clusterName + "-mirror-maker-2";
    KafkaMirrorMaker2 kafkaMirrorMaker2 = KafkaMirrorMaker2Templates.kafkaMirrorMaker2(mirrorMaker2Name, "non-existing-source", "non-existing-target", 1, false).build();
    resourceManager.createResource(extensionContext, false, kafkaMirrorMaker2);
    KafkaMirrorMaker2Utils.waitForKafkaMirrorMaker2NotReady(mirrorMaker2Name);
    // delete
    KafkaMirrorMaker2Resource.kafkaMirrorMaker2Client().inNamespace(Constants.INFRA_NAMESPACE).withName(mirrorMaker2Name).withPropagationPolicy(DeletionPropagation.FOREGROUND).delete();
    DeploymentUtils.waitForDeploymentDeletion(KafkaMirrorMaker2Resources.deploymentName(mirrorMaker2Name));
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) KafkaMirrorMaker2(io.strimzi.api.kafka.model.KafkaMirrorMaker2) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest) Tag(org.junit.jupiter.api.Tag)

Example 29 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.

the class CustomResourceStatusIsolatedST method testKafkaTopicStatusNotReady.

@ParallelTest
void testKafkaTopicStatusNotReady(ExtensionContext extensionContext) {
    String topicName = mapWithTestTopics.get(extensionContext.getDisplayName());
    resourceManager.createResource(extensionContext, false, KafkaTopicTemplates.topic(CUSTOM_RESOURCE_STATUS_CLUSTER_NAME, topicName, 1, 10, 10).editMetadata().withNamespace(Constants.INFRA_NAMESPACE).endMetadata().build());
    KafkaTopicUtils.waitForKafkaTopicNotReady(Constants.INFRA_NAMESPACE, topicName);
    assertKafkaTopicStatus(1, topicName);
    cmdKubeClient(Constants.INFRA_NAMESPACE).deleteByName(KafkaTopic.RESOURCE_KIND, topicName);
    KafkaTopicUtils.waitForKafkaTopicDeletion(Constants.INFRA_NAMESPACE, topicName);
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Example 30 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi by strimzi.

the class TopicST method testCreateTopicAfterUnsupportedOperation.

@ParallelTest
void testCreateTopicAfterUnsupportedOperation(ExtensionContext extensionContext) {
    String topicName = "topic-with-replication-to-change";
    String newTopicName = "another-topic";
    KafkaTopic kafkaTopic = KafkaTopicTemplates.topic(TOPIC_CLUSTER_NAME, topicName, namespace).editSpec().withReplicas(3).withPartitions(3).endSpec().build();
    resourceManager.createResource(extensionContext, kafkaTopic);
    KafkaTopicResource.replaceTopicResourceInSpecificNamespace(topicName, t -> {
        t.getSpec().setReplicas(1);
        t.getSpec().setPartitions(1);
    }, namespace);
    KafkaTopicUtils.waitForKafkaTopicNotReady(namespace, topicName);
    String exceptedMessage = "Number of partitions cannot be decreased";
    assertThat(KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(topicName).get().getStatus().getConditions().get(0).getMessage(), is(exceptedMessage));
    String topicCRDMessage = KafkaTopicResource.kafkaTopicClient().inNamespace(namespace).withName(topicName).get().getStatus().getConditions().get(0).getMessage();
    assertThat(topicCRDMessage, containsString(exceptedMessage));
    KafkaTopic newKafkaTopic = KafkaTopicTemplates.topic(TOPIC_CLUSTER_NAME, newTopicName, 1, 1).editMetadata().withNamespace(namespace).endMetadata().build();
    resourceManager.createResource(extensionContext, newKafkaTopic);
    assertThat("Topic exists in Kafka itself", hasTopicInKafka(topicName, TOPIC_CLUSTER_NAME));
    assertThat("Topic exists in Kafka CR (Kubernetes)", hasTopicInCRK8s(kafkaTopic, topicName));
    assertThat("Topic exists in Kafka itself", hasTopicInKafka(newTopicName, TOPIC_CLUSTER_NAME));
    assertThat("Topic exists in Kafka CR (Kubernetes)", hasTopicInCRK8s(newKafkaTopic, newTopicName));
    cmdKubeClient(namespace).deleteByName(KafkaTopic.RESOURCE_SINGULAR, topicName);
    KafkaTopicUtils.waitForKafkaTopicDeletion(namespace, topicName);
    cmdKubeClient(namespace).deleteByName(KafkaTopic.RESOURCE_SINGULAR, newTopicName);
    KafkaTopicUtils.waitForKafkaTopicDeletion(namespace, newTopicName);
}
Also used : KafkaTopic(io.strimzi.api.kafka.model.KafkaTopic) Matchers.containsString(org.hamcrest.Matchers.containsString) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Aggregations

ParallelTest (io.strimzi.systemtest.annotations.ParallelTest)192 Tag (org.junit.jupiter.api.Tag)62 InternalKafkaClient (io.strimzi.systemtest.kafkaclients.clients.InternalKafkaClient)38 Matchers.containsString (org.hamcrest.Matchers.containsString)38 KafkaOauthClients (io.strimzi.systemtest.kafkaclients.internalClients.KafkaOauthClients)32 KafkaOauthClientsBuilder (io.strimzi.systemtest.kafkaclients.internalClients.KafkaOauthClientsBuilder)32 OptionalDouble (java.util.OptionalDouble)28 Pattern (java.util.regex.Pattern)28 StringContains.containsString (org.hamcrest.core.StringContains.containsString)28 BridgeClients (io.strimzi.systemtest.kafkaclients.internalClients.BridgeClients)26 BridgeClientsBuilder (io.strimzi.systemtest.kafkaclients.internalClients.BridgeClientsBuilder)26 Description (io.vertx.core.cli.annotations.Description)24 KafkaUser (io.strimzi.api.kafka.model.KafkaUser)16 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)16 KafkaResources (io.strimzi.api.kafka.model.KafkaResources)14 AbstractST (io.strimzi.systemtest.AbstractST)14 Constants (io.strimzi.systemtest.Constants)14 INFRA_NAMESPACE (io.strimzi.systemtest.Constants.INFRA_NAMESPACE)14 REGRESSION (io.strimzi.systemtest.Constants.REGRESSION)14 IsolatedSuite (io.strimzi.systemtest.annotations.IsolatedSuite)14