Search in sources :

Example 6 with KafkaTracingClientsBuilder

use of io.strimzi.systemtest.kafkaclients.internalClients.KafkaTracingClientsBuilder in project strimzi-kafka-operator 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