Search in sources :

Example 1 with KafkaTracingClientsBuilder

use of io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder in project strimzi by strimzi.

the class TracingST method testProducerConsumerMirrorMaker2Service.

@ParallelNamespaceTest
@Tag(MIRROR_MAKER2)
void testProducerConsumerMirrorMaker2Service(ExtensionContext extensionContext) {
    // Current implementation of Jaeger deployment and test parallelism does not allow to run this test with STRIMZI_RBAC_SCOPE=NAMESPACE`
    assumeFalse(Environment.isNamespaceRbacScope());
    final String kafkaClusterSourceName = storageMap.get(extensionContext).getClusterName();
    final String kafkaClusterTargetName = storageMap.get(extensionContext).getClusterName() + "-target";
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(kafkaClusterSourceName, 1).build());
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(kafkaClusterTargetName, 1).build());
    // Create topic and deploy clients before Mirror Maker to not wait for MM to find the new topics
    resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(kafkaClusterSourceName, storageMap.get(extensionContext).getTopicName()).editSpec().withReplicas(1).withPartitions(12).endSpec().build());
    resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(kafkaClusterTargetName, kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName()).editSpec().withReplicas(1).withPartitions(12).endSpec().build());
    LOGGER.info("Setting for kafka source plain bootstrap:{}", KafkaResources.plainBootstrapAddress(kafkaClusterSourceName));
    KafkaTracingClients sourceKafkaTracingClient = new KafkaTracingClientsBuilder((KafkaTracingClients) storageMap.get(extensionContext).retrieveFromTestStorage(KAFKA_TRACING_CLIENT_KEY)).withTopicName(storageMap.get(extensionContext).getTopicName()).withBootstrapAddress(KafkaResources.plainBootstrapAddress(kafkaClusterSourceName)).build();
    resourceManager.createResource(extensionContext, sourceKafkaTracingClient.producerWithTracing());
    LOGGER.info("Setting for kafka target plain bootstrap:{}", KafkaResources.plainBootstrapAddress(kafkaClusterTargetName));
    KafkaTracingClients targetKafkaTracingClient = new KafkaTracingClientsBuilder((KafkaTracingClients) storageMap.get(extensionContext).retrieveFromTestStorage(KAFKA_TRACING_CLIENT_KEY)).withBootstrapAddress(KafkaResources.plainBootstrapAddress(kafkaClusterTargetName)).withTopicName(kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName()).build();
    resourceManager.createResource(extensionContext, targetKafkaTracingClient.consumerWithTracing());
    resourceManager.createResource(extensionContext, KafkaMirrorMaker2Templates.kafkaMirrorMaker2(storageMap.get(extensionContext).getClusterName(), kafkaClusterTargetName, kafkaClusterSourceName, 1, false).editSpec().withNewJaegerTracing().endJaegerTracing().withNewTemplate().withNewConnectContainer().addNewEnv().withName("JAEGER_SERVICE_NAME").withValue(JAEGER_MIRROR_MAKER2_SERVICE).endEnv().addNewEnv().withName("JAEGER_AGENT_HOST").withValue(JAEGER_AGENT_NAME).endEnv().addNewEnv().withName("JAEGER_SAMPLER_TYPE").withValue(JAEGER_SAMPLER_TYPE).endEnv().addNewEnv().withName("JAEGER_SAMPLER_PARAM").withValue(JAEGER_SAMPLER_PARAM).endEnv().endConnectContainer().endTemplate().endSpec().build());
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_PRODUCER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "To_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_CONSUMER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "From_" + kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_MIRROR_MAKER2_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "From_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_MIRROR_MAKER2_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "To_" + kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
}
Also used : KafkaTracingClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClients) KafkaTracingClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder) ParallelNamespaceTest(io.strimzi.systemtest.annotations.ParallelNamespaceTest) Tag(org.junit.jupiter.api.Tag)

Example 2 with KafkaTracingClientsBuilder

use of io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder in project strimzi by strimzi.

the class TracingST method createTestResources.

@BeforeEach
void createTestResources(ExtensionContext extensionContext) {
    TestStorage testStorage = new TestStorage(extensionContext, namespace);
    storageMap.put(extensionContext, testStorage);
    deployJaegerInstance(extensionContext, storageMap.get(extensionContext).getNamespaceName());
    resourceManager.createResource(extensionContext, ScraperTemplates.scraperPod(storageMap.get(extensionContext).getNamespaceName(), storageMap.get(extensionContext).getScraperName()).build());
    testStorage.addToTestStorage(Constants.SCRAPER_POD_KEY, kubeClient().listPodsByPrefixInName(storageMap.get(extensionContext).getNamespaceName(), storageMap.get(extensionContext).getScraperName()).get(0).getMetadata().getName());
    storageMap.put(extensionContext, testStorage);
    final KafkaTracingClients kafkaTracingClient = new KafkaTracingClientsBuilder().withNamespaceName(storageMap.get(extensionContext).getNamespaceName()).withProducerName(storageMap.get(extensionContext).getProducerName()).withConsumerName(storageMap.get(extensionContext).getConsumerName()).withBootstrapAddress(KafkaResources.plainBootstrapAddress(storageMap.get(extensionContext).getClusterName())).withTopicName(storageMap.get(extensionContext).getTopicName()).withStreamsTopicTargetName(storageMap.get(extensionContext).retrieveFromTestStorage(Constants.STREAM_TOPIC_KEY).toString()).withMessageCount(MESSAGE_COUNT).withJaegerServiceProducerName(JAEGER_PRODUCER_SERVICE).withJaegerServiceConsumerName(JAEGER_CONSUMER_SERVICE).withJaegerServiceStreamsName(JAEGER_KAFKA_STREAMS_SERVICE).withJaegerServerAgentName(JAEGER_AGENT_NAME).build();
    testStorage.addToTestStorage(Constants.KAFKA_TRACING_CLIENT_KEY, kafkaTracingClient);
    storageMap.put(extensionContext, testStorage);
}
Also used : KafkaTracingClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClients) KafkaTracingClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder) TestStorage(io.strimzi.systemtest.storage.TestStorage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with KafkaTracingClientsBuilder

use of io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder in project strimzi-kafka-operator by strimzi.

the class TracingST method testProducerConsumerMirrorMaker2Service.

@ParallelNamespaceTest
@Tag(MIRROR_MAKER2)
void testProducerConsumerMirrorMaker2Service(ExtensionContext extensionContext) {
    // Current implementation of Jaeger deployment and test parallelism does not allow to run this test with STRIMZI_RBAC_SCOPE=NAMESPACE`
    assumeFalse(Environment.isNamespaceRbacScope());
    final String kafkaClusterSourceName = storageMap.get(extensionContext).getClusterName();
    final String kafkaClusterTargetName = storageMap.get(extensionContext).getClusterName() + "-target";
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(kafkaClusterSourceName, 1).build());
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(kafkaClusterTargetName, 1).build());
    // Create topic and deploy clients before Mirror Maker to not wait for MM to find the new topics
    resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(kafkaClusterSourceName, storageMap.get(extensionContext).getTopicName()).editSpec().withReplicas(1).withPartitions(12).endSpec().build());
    resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(kafkaClusterTargetName, kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName()).editSpec().withReplicas(1).withPartitions(12).endSpec().build());
    LOGGER.info("Setting for kafka source plain bootstrap:{}", KafkaResources.plainBootstrapAddress(kafkaClusterSourceName));
    KafkaTracingClients sourceKafkaTracingClient = new KafkaTracingClientsBuilder((KafkaTracingClients) storageMap.get(extensionContext).retrieveFromTestStorage(KAFKA_TRACING_CLIENT_KEY)).withTopicName(storageMap.get(extensionContext).getTopicName()).withBootstrapAddress(KafkaResources.plainBootstrapAddress(kafkaClusterSourceName)).build();
    resourceManager.createResource(extensionContext, sourceKafkaTracingClient.producerWithTracing());
    LOGGER.info("Setting for kafka target plain bootstrap:{}", KafkaResources.plainBootstrapAddress(kafkaClusterTargetName));
    KafkaTracingClients targetKafkaTracingClient = new KafkaTracingClientsBuilder((KafkaTracingClients) storageMap.get(extensionContext).retrieveFromTestStorage(KAFKA_TRACING_CLIENT_KEY)).withBootstrapAddress(KafkaResources.plainBootstrapAddress(kafkaClusterTargetName)).withTopicName(kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName()).build();
    resourceManager.createResource(extensionContext, targetKafkaTracingClient.consumerWithTracing());
    resourceManager.createResource(extensionContext, KafkaMirrorMaker2Templates.kafkaMirrorMaker2(storageMap.get(extensionContext).getClusterName(), kafkaClusterTargetName, kafkaClusterSourceName, 1, false).editSpec().withNewJaegerTracing().endJaegerTracing().withNewTemplate().withNewConnectContainer().addNewEnv().withName("JAEGER_SERVICE_NAME").withValue(JAEGER_MIRROR_MAKER2_SERVICE).endEnv().addNewEnv().withName("JAEGER_AGENT_HOST").withValue(JAEGER_AGENT_NAME).endEnv().addNewEnv().withName("JAEGER_SAMPLER_TYPE").withValue(JAEGER_SAMPLER_TYPE).endEnv().addNewEnv().withName("JAEGER_SAMPLER_PARAM").withValue(JAEGER_SAMPLER_PARAM).endEnv().endConnectContainer().endTemplate().endSpec().build());
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_PRODUCER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "To_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_CONSUMER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "From_" + kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_MIRROR_MAKER2_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "From_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_MIRROR_MAKER2_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "To_" + kafkaClusterSourceName + "." + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
}
Also used : KafkaTracingClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClients) KafkaTracingClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder) ParallelNamespaceTest(io.strimzi.systemtest.annotations.ParallelNamespaceTest) Tag(org.junit.jupiter.api.Tag)

Example 4 with KafkaTracingClientsBuilder

use of io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder in project strimzi-kafka-operator by strimzi.

the class TracingST method createTestResources.

@BeforeEach
void createTestResources(ExtensionContext extensionContext) {
    TestStorage testStorage = new TestStorage(extensionContext, namespace);
    storageMap.put(extensionContext, testStorage);
    deployJaegerInstance(extensionContext, storageMap.get(extensionContext).getNamespaceName());
    resourceManager.createResource(extensionContext, ScraperTemplates.scraperPod(storageMap.get(extensionContext).getNamespaceName(), storageMap.get(extensionContext).getScraperName()).build());
    testStorage.addToTestStorage(Constants.SCRAPER_POD_KEY, kubeClient().listPodsByPrefixInName(storageMap.get(extensionContext).getNamespaceName(), storageMap.get(extensionContext).getScraperName()).get(0).getMetadata().getName());
    storageMap.put(extensionContext, testStorage);
    final KafkaTracingClients kafkaTracingClient = new KafkaTracingClientsBuilder().withNamespaceName(storageMap.get(extensionContext).getNamespaceName()).withProducerName(storageMap.get(extensionContext).getProducerName()).withConsumerName(storageMap.get(extensionContext).getConsumerName()).withBootstrapAddress(KafkaResources.plainBootstrapAddress(storageMap.get(extensionContext).getClusterName())).withTopicName(storageMap.get(extensionContext).getTopicName()).withStreamsTopicTargetName(storageMap.get(extensionContext).retrieveFromTestStorage(Constants.STREAM_TOPIC_KEY).toString()).withMessageCount(MESSAGE_COUNT).withJaegerServiceProducerName(JAEGER_PRODUCER_SERVICE).withJaegerServiceConsumerName(JAEGER_CONSUMER_SERVICE).withJaegerServiceStreamsName(JAEGER_KAFKA_STREAMS_SERVICE).withJaegerServerAgentName(JAEGER_AGENT_NAME).build();
    testStorage.addToTestStorage(Constants.KAFKA_TRACING_CLIENT_KEY, kafkaTracingClient);
    storageMap.put(extensionContext, testStorage);
}
Also used : KafkaTracingClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClients) KafkaTracingClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder) TestStorage(io.strimzi.systemtest.storage.TestStorage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with KafkaTracingClientsBuilder

use of io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder in project strimzi by strimzi.

the class TracingST method testProducerConsumerMirrorMakerService.

@ParallelNamespaceTest
@Tag(MIRROR_MAKER)
void testProducerConsumerMirrorMakerService(ExtensionContext extensionContext) {
    // Current implementation of Jaeger deployment and test parallelism does not allow to run this test with STRIMZI_RBAC_SCOPE=NAMESPACE`
    assumeFalse(Environment.isNamespaceRbacScope());
    final String kafkaClusterSourceName = storageMap.get(extensionContext).getClusterName();
    final String kafkaClusterTargetName = storageMap.get(extensionContext).getClusterName() + "-target";
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(kafkaClusterSourceName, 1).build());
    resourceManager.createResource(extensionContext, KafkaTemplates.kafkaEphemeral(kafkaClusterTargetName, 1).build());
    // Create topic and deploy clients before Mirror Maker to not wait for MM to find the new topics
    resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(kafkaClusterSourceName, storageMap.get(extensionContext).getTopicName()).editSpec().withReplicas(1).withPartitions(12).endSpec().build());
    resourceManager.createResource(extensionContext, KafkaTopicTemplates.topic(kafkaClusterTargetName, storageMap.get(extensionContext).getTopicName() + "-target").editSpec().withReplicas(1).withPartitions(12).withTopicName(storageMap.get(extensionContext).getTopicName()).endSpec().build());
    LOGGER.info("Setting for kafka source plain bootstrap:{}", KafkaResources.plainBootstrapAddress(kafkaClusterSourceName));
    KafkaTracingClients sourceKafkaTracingClient = new KafkaTracingClientsBuilder((KafkaTracingClients) storageMap.get(extensionContext).retrieveFromTestStorage(KAFKA_TRACING_CLIENT_KEY)).withBootstrapAddress(KafkaResources.plainBootstrapAddress(kafkaClusterSourceName)).build();
    resourceManager.createResource(extensionContext, sourceKafkaTracingClient.producerWithTracing());
    LOGGER.info("Setting for kafka target plain bootstrap:{}", KafkaResources.plainBootstrapAddress(kafkaClusterTargetName));
    KafkaTracingClients targetKafkaTracingClient = new KafkaTracingClientsBuilder((KafkaTracingClients) storageMap.get(extensionContext).retrieveFromTestStorage(KAFKA_TRACING_CLIENT_KEY)).withBootstrapAddress(KafkaResources.plainBootstrapAddress(kafkaClusterTargetName)).build();
    resourceManager.createResource(extensionContext, targetKafkaTracingClient.consumerWithTracing());
    resourceManager.createResource(extensionContext, KafkaMirrorMakerTemplates.kafkaMirrorMaker(storageMap.get(extensionContext).getClusterName(), kafkaClusterSourceName, kafkaClusterTargetName, ClientUtils.generateRandomConsumerGroup(), 1, false).editSpec().withNewJaegerTracing().endJaegerTracing().withNewTemplate().withNewMirrorMakerContainer().addNewEnv().withName("JAEGER_SERVICE_NAME").withValue(JAEGER_MIRROR_MAKER_SERVICE).endEnv().addNewEnv().withName("JAEGER_AGENT_HOST").withValue(JAEGER_AGENT_NAME).endEnv().addNewEnv().withName("JAEGER_SAMPLER_TYPE").withValue(JAEGER_SAMPLER_TYPE).endEnv().addNewEnv().withName("JAEGER_SAMPLER_PARAM").withValue(JAEGER_SAMPLER_PARAM).endEnv().endMirrorMakerContainer().endTemplate().endSpec().build());
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_PRODUCER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "To_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_CONSUMER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "From_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_MIRROR_MAKER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "From_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
    TracingUtils.verify(storageMap.get(extensionContext).getNamespaceName(), JAEGER_MIRROR_MAKER_SERVICE, storageMap.get(extensionContext).retrieveFromTestStorage(Constants.SCRAPER_POD_KEY).toString(), "To_" + storageMap.get(extensionContext).getTopicName(), JAEGER_QUERY_SERVICE);
}
Also used : KafkaTracingClients(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClients) KafkaTracingClientsBuilder(io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder) ParallelNamespaceTest(io.strimzi.systemtest.annotations.ParallelNamespaceTest) Tag(org.junit.jupiter.api.Tag)

Aggregations

KafkaTracingClients (io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClients)6 KafkaTracingClientsBuilder (io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder)6 ParallelNamespaceTest (io.strimzi.systemtest.annotations.ParallelNamespaceTest)4 Tag (org.junit.jupiter.api.Tag)4 TestStorage (io.strimzi.systemtest.storage.TestStorage)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2