Search in sources :

Example 81 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.

the class OauthPlainIsolatedST method testSaslPlainAuthenticationKafkaConnectIsAbleToConnectToKafkaOAuth.

@ParallelTest
void testSaslPlainAuthenticationKafkaConnectIsAbleToConnectToKafkaOAuth(ExtensionContext extensionContext) {
    TestStorage testStorage = new TestStorage(extensionContext);
    resourceManager.createResource(extensionContext, KafkaClientsTemplates.kafkaClients(false, testStorage.getKafkaClientsName()).build());
    resourceManager.createResource(extensionContext, false, KafkaConnectTemplates.kafkaConnect(extensionContext, testStorage.getClusterName(), oauthClusterName, 1).withNewSpec().withReplicas(1).withBootstrapServers(KafkaResources.plainBootstrapAddress(oauthClusterName)).withConfig(connectorConfig).addToConfig("key.converter.schemas.enable", false).addToConfig("value.converter.schemas.enable", false).addToConfig("key.converter", "org.apache.kafka.connect.storage.StringConverter").addToConfig("value.converter", "org.apache.kafka.connect.storage.StringConverter").withNewKafkaClientAuthenticationPlain().withUsername("kafka-connect").withNewPasswordSecret().withSecretName(CONNECT_OAUTH_SECRET).withPassword("clientSecret").endPasswordSecret().endKafkaClientAuthenticationPlain().withTls(null).endSpec().build());
    // verify that KafkaConnect is able to connect to Oauth Kafka configured as plain
    KafkaConnectUtils.waitForConnectReady(testStorage.getNamespaceName(), testStorage.getClusterName());
}
Also used : TestStorage(io.strimzi.systemtest.storage.TestStorage) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Example 82 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.

the class UserST method testScramUserWithQuotas.

@ParallelTest
void testScramUserWithQuotas(ExtensionContext extensionContext) {
    KafkaUser user = KafkaUserTemplates.scramShaUser(namespace, userClusterName, "scramed-arnost").build();
    testUserWithQuotas(extensionContext, user);
}
Also used : KafkaUser(io.strimzi.api.kafka.model.KafkaUser) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Example 83 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.

the class UserST method testUserTemplate.

@ParallelTest
void testUserTemplate(ExtensionContext extensionContext) {
    String userName = mapWithTestUsers.get(extensionContext.getDisplayName());
    String labelKey = "test-label-key";
    String labelValue = "test-label-value";
    String annotationKey = "test-annotation-key";
    String annotationValue = "test-annotation-value";
    resourceManager.createResource(extensionContext, KafkaUserTemplates.tlsUser(namespace, userClusterName, userName).editSpec().editOrNewTemplate().editOrNewSecret().editOrNewMetadata().addToLabels(labelKey, labelValue).addToAnnotations(annotationKey, annotationValue).endMetadata().endSecret().endTemplate().endSpec().build());
    Secret userSecret = kubeClient(namespace).getSecret(userName);
    assertThat(userSecret.getMetadata().getLabels().get(labelKey), is(labelValue));
    assertThat(userSecret.getMetadata().getAnnotations().get(annotationKey), is(annotationValue));
}
Also used : Secret(io.fabric8.kubernetes.api.model.Secret) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Example 84 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.

the class UserST method testTlsUserWithQuotas.

@ParallelTest
void testTlsUserWithQuotas(ExtensionContext extensionContext) {
    KafkaUser user = KafkaUserTemplates.tlsUser(namespace, userClusterName, "encrypted-arnost").build();
    testUserWithQuotas(extensionContext, user);
}
Also used : KafkaUser(io.strimzi.api.kafka.model.KafkaUser) ParallelTest(io.strimzi.systemtest.annotations.ParallelTest)

Example 85 with ParallelTest

use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.

the class OpaIntegrationST method testOpaAuthorization.

@ParallelTest
void testOpaAuthorization(ExtensionContext extensionContext) {
    String clusterName = mapWithClusterNames.get(extensionContext.getDisplayName());
    String topicName = mapWithTestTopics.get(extensionContext.getDisplayName());
    final String consumerGroupName = "consumer-group-name-1";
    final String kafkaClientsDeploymentName = clusterName + "-" + Constants.KAFKA_CLIENTS;
    // Deploy client pod with custom certificates and collect messages from internal TLS listener
    KafkaUser goodUser = KafkaUserTemplates.tlsUser(namespace, CLUSTER_NAME, OPA_GOOD_USER).build();
    KafkaUser badUser = KafkaUserTemplates.tlsUser(namespace, CLUSTER_NAME, OPA_BAD_USER).build();
    resourceManager.createResource(extensionContext, goodUser);
    resourceManager.createResource(extensionContext, badUser);
    resourceManager.createResource(extensionContext, KafkaClientsTemplates.kafkaClients(true, kafkaClientsDeploymentName, false, goodUser, badUser).editMetadata().withNamespace(namespace).endMetadata().build());
    final String clientsPodName = kubeClient(namespace).listPodsByPrefixInName(namespace, kafkaClientsDeploymentName).get(0).getMetadata().getName();
    LOGGER.info("Checking KafkaUser {} that is able to send and receive messages to/from topic '{}'", OPA_GOOD_USER, topicName);
    // Setup kafka client
    InternalKafkaClient internalKafkaClient = new InternalKafkaClient.Builder().withTopicName(topicName).withNamespaceName(namespace).withClusterName(CLUSTER_NAME).withKafkaUsername(OPA_GOOD_USER).withMessageCount(MESSAGE_COUNT).withConsumerGroupName(consumerGroupName).withSecurityProtocol(SecurityProtocol.SSL).withUsingPodName(clientsPodName).withListenerName(Constants.TLS_LISTENER_DEFAULT_NAME).build();
    internalKafkaClient.produceAndConsumesTlsMessagesUntilBothOperationsAreSuccessful();
    LOGGER.info("Checking KafkaUser {} that is not able to send or receive messages to/from topic '{}'", OPA_BAD_USER, topicName);
    internalKafkaClient = internalKafkaClient.toBuilder().withKafkaUsername(OPA_BAD_USER).build();
    assertThat(internalKafkaClient.sendMessagesTls(), is(-1));
    assertThat(internalKafkaClient.receiveMessagesTls(), is(0));
}
Also used : GenericKafkaListenerBuilder(io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListenerBuilder) InternalKafkaClient(io.strimzi.systemtest.kafkaclients.clients.InternalKafkaClient) KafkaUser(io.strimzi.api.kafka.model.KafkaUser) 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