Search in sources :

Example 91 with IsolatedTest

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

the class KafkaUpgradeDowngradeIsolatedST method testKafkaClusterDowngradeToOlderMessageFormat.

@IsolatedTest
void testKafkaClusterDowngradeToOlderMessageFormat(ExtensionContext testContext) {
    List<TestKafkaVersion> sortedVersions = TestKafkaVersion.getSupportedKafkaVersions();
    String clusterName = mapWithClusterNames.get(testContext.getDisplayName());
    String producerName = clusterName + "-producer";
    String consumerName = clusterName + "-consumer";
    String initLogMsgFormat = sortedVersions.get(0).messageVersion();
    String initInterBrokerProtocol = sortedVersions.get(0).protocolVersion();
    for (int x = sortedVersions.size() - 1; x > 0; x--) {
        TestKafkaVersion initialVersion = sortedVersions.get(x);
        TestKafkaVersion newVersion = sortedVersions.get(x - 1);
        runVersionChange(initialVersion, newVersion, producerName, consumerName, initLogMsgFormat, initInterBrokerProtocol, 3, 3, testContext);
    }
    // ##############################
    // Validate that continuous clients finished successfully
    // ##############################
    ClientUtils.waitTillContinuousClientsFinish(producerName, consumerName, INFRA_NAMESPACE, continuousClientsMessageCount);
// ##############################
}
Also used : TestKafkaVersion(io.strimzi.systemtest.utils.TestKafkaVersion) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Example 92 with IsolatedTest

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

the class ClusterOperationIsolatedST method testAvailabilityDuringNodeDrain.

@IsolatedTest
@MultiNodeClusterOnly
@RequiredMinKubeApiVersion(version = 1.15)
void testAvailabilityDuringNodeDrain(ExtensionContext extensionContext) {
    String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    int size = 5;
    List<String> topicNames = IntStream.range(0, size).boxed().map(i -> "test-topic-" + i).collect(Collectors.toList());
    List<String> producerNames = IntStream.range(0, size).boxed().map(i -> "hello-world-producer-" + i).collect(Collectors.toList());
    List<String> consumerNames = IntStream.range(0, size).boxed().map(i -> "hello-world-consumer-" + i).collect(Collectors.toList());
    List<String> continuousConsumerGroups = IntStream.range(0, size).boxed().map(i -> "continuous-consumer-group-" + i).collect(Collectors.toList());
    int continuousClientsMessageCount = 300;
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaPersistent(clusterName, 3, 3).editOrNewSpec().editEntityOperator().editUserOperator().withReconciliationIntervalSeconds(30).endUserOperator().endEntityOperator().endSpec().build());
    topicNames.forEach(topicName -> resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(clusterName, topicName, 3, 3, 2).build()));
    String producerAdditionConfiguration = "delivery.timeout.ms=20000\nrequest.timeout.ms=20000";
    KafkaClients kafkaBasicClientResource;
    for (int i = 0; i < size; i++) {
        kafkaBasicClientResource = new KafkaClientsBuilder().withProducerName(producerNames.get(i)).withConsumerName(consumerNames.get(i)).withBootstrapAddress(KafkaResources.plainBootstrapAddress(clusterName)).withTopicName(topicNames.get(i)).withMessageCount(continuousClientsMessageCount).withAdditionalConfig(producerAdditionConfiguration).withConsumerGroup(continuousConsumerGroups.get(i)).withDelayMs(1000).build();
        resourceManager.createResource(extensionContext, kafkaBasicClientResource.producerStrimzi());
        resourceManager.createResource(extensionContext, kafkaBasicClientResource.consumerStrimzi());
    }
    // ##############################
    // Nodes draining
    // ##############################
    kubeClient().getClusterWorkers().forEach(node -> {
        NodeUtils.drainNode(node.getMetadata().getName());
        NodeUtils.cordonNode(node.getMetadata().getName(), true);
    });
    producerNames.forEach(producerName -> ClientUtils.waitTillContinuousClientsFinish(producerName, consumerNames.get(producerName.indexOf(producerName)), NAMESPACE, continuousClientsMessageCount));
    producerNames.forEach(producerName -> kubeClient().deleteJob(producerName));
    consumerNames.forEach(consumerName -> kubeClient().deleteJob(consumerName));
}
Also used : AbstractST(io.strimzi.systemtest.AbstractST) MultiNodeClusterOnly(io.strimzi.systemtest.annotations.MultiNodeClusterOnly) KafkaTemplates(io.strimzi.systemtest.templates.crd.KafkaTemplates) IntStream(java.util.stream.IntStream) KafkaClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaClients) IsolatedSuite(io.strimzi.test.annotations.IsolatedSuite) SPECIFIC(io.strimzi.systemtest.Constants.SPECIFIC) KafkaClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaClientsBuilder) ExtensionContext(org.junit.jupiter.api.extension.ExtensionContext) Collectors(java.util.stream.Collectors) ClientUtils(io.strimzi.systemtest.utils.ClientUtils) KubeClusterResource.kubeClient(io.strimzi.test.k8s.KubeClusterResource.kubeClient) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest) RequiredMinKubeApiVersion(io.strimzi.systemtest.annotations.RequiredMinKubeApiVersion) NodeUtils(io.strimzi.systemtest.utils.kubeUtils.objects.NodeUtils) AfterEach(org.junit.jupiter.api.AfterEach) List(java.util.List) Logger(org.apache.logging.log4j.Logger) KafkaTopicTemplates(io.strimzi.systemtest.templates.crd.KafkaTopicTemplates) KafkaResources(io.strimzi.api.kafka.model.KafkaResources) BeforeAll(org.junit.jupiter.api.BeforeAll) Tag(org.junit.jupiter.api.Tag) LogManager(org.apache.logging.log4j.LogManager) KafkaClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaClientsBuilder) KafkaClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaClients) MultiNodeClusterOnly(io.strimzi.systemtest.annotations.MultiNodeClusterOnly) RequiredMinKubeApiVersion(io.strimzi.systemtest.annotations.RequiredMinKubeApiVersion) IsolatedTest(io.strimzi.systemtest.annotations.IsolatedTest)

Aggregations

IsolatedTest (io.strimzi.systemtest.annotations.IsolatedTest)92 Tag (org.junit.jupiter.api.Tag)64 GenericKafkaListenerBuilder (io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder)30 HashMap (java.util.HashMap)22 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)20 KafkaTemplates (io.strimzi.systemtest.templates.crd.KafkaTemplates)20 Collectors (java.util.stream.Collectors)20 ExtensionContext (org.junit.jupiter.api.extension.ExtensionContext)20 AbstractST (io.strimzi.systemtest.AbstractST)18 REGRESSION (io.strimzi.systemtest.Constants.REGRESSION)18 InternalKafkaClient (io.strimzi.systemtest.kafkaclients.clients.InternalKafkaClient)18 KafkaTopicTemplates (io.strimzi.systemtest.templates.crd.KafkaTopicTemplates)18 Map (java.util.Map)18 KafkaResources (io.strimzi.api.kafka.model.KafkaResources)16 KafkaClientsBuilder (io.strimzi.systemtest.kafkaclients.internalClients.KafkaClientsBuilder)16 LogManager (org.apache.logging.log4j.LogManager)16 Logger (org.apache.logging.log4j.Logger)16 Constants (io.strimzi.systemtest.Constants)14 SetupClusterOperator (io.strimzi.systemtest.resources.operator.SetupClusterOperator)14 RollingUpdateUtils (io.strimzi.systemtest.utils.RollingUpdateUtils)14