Search in sources :

Example 41 with MockKube

use of io.strimzi.test.mockkube.MockKube in project strimzi-kafka-operator by strimzi.

the class ConfigTest method testInvalidTlsSecurityProtocolConfig.

@Test
public void testInvalidTlsSecurityProtocolConfig() {
    Map<String, String> map = new HashMap<>(MANDATORY);
    map.put(Config.SECURITY_PROTOCOL.key, "PLAINTEXT");
    map.put(Config.TLS_ENABLED.key, "true");
    MockKube mockKube = new MockKube();
    KubernetesClient kubeClient = mockKube.build();
    Config config = new Config(map);
    Session session = new Session(kubeClient, config);
    assertThrows(InvalidConfigurationException.class, () -> session.adminClientProperties());
}
Also used : MockKube(io.strimzi.test.mockkube.MockKube) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) HashMap(java.util.HashMap) AdminClientConfig(org.apache.kafka.clients.admin.AdminClientConfig) Test(org.junit.jupiter.api.Test)

Example 42 with MockKube

use of io.strimzi.test.mockkube.MockKube in project strimzi-kafka-operator by strimzi.

the class ConfigTest method testSecurityProtocolConfig.

@Test
public void testSecurityProtocolConfig() {
    Map<String, String> map = new HashMap<>(MANDATORY);
    map.put(Config.SECURITY_PROTOCOL.key, "SSL");
    MockKube mockKube = new MockKube();
    KubernetesClient kubeClient = mockKube.build();
    Config config = new Config(map);
    Session session = new Session(kubeClient, config);
    Properties adminClientProps = session.adminClientProperties();
    assertThat(adminClientProps.getProperty(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG), is("HTTPS"));
    assertThat(adminClientProps.getProperty(AdminClientConfig.SECURITY_PROTOCOL_CONFIG), is("SSL"));
}
Also used : MockKube(io.strimzi.test.mockkube.MockKube) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) HashMap(java.util.HashMap) AdminClientConfig(org.apache.kafka.clients.admin.AdminClientConfig) Properties(java.util.Properties) Test(org.junit.jupiter.api.Test)

Aggregations

MockKube (io.strimzi.test.mockkube.MockKube)42 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)22 HashMap (java.util.HashMap)20 Test (org.junit.jupiter.api.Test)20 ResourceOperatorSupplier (io.strimzi.operator.cluster.operator.resource.ResourceOperatorSupplier)18 PlatformFeaturesAvailability (io.strimzi.operator.PlatformFeaturesAvailability)16 AdminClientConfig (org.apache.kafka.clients.admin.AdminClientConfig)16 BeforeEach (org.junit.jupiter.api.BeforeEach)14 CustomResourceDefinition (io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition)10 PasswordGenerator (io.strimzi.operator.common.PasswordGenerator)10 Reconciliation (io.strimzi.operator.common.Reconciliation)10 MockCertManager (io.strimzi.operator.common.operator.MockCertManager)10 KafkaList (io.strimzi.api.kafka.KafkaList)8 StrimziPodSetList (io.strimzi.api.kafka.StrimziPodSetList)8 Kafka (io.strimzi.api.kafka.model.Kafka)8 StrimziPodSet (io.strimzi.api.kafka.model.StrimziPodSet)8 ClusterOperatorConfig (io.strimzi.operator.cluster.ClusterOperatorConfig)8 Checkpoint (io.vertx.junit5.Checkpoint)8 Properties (java.util.Properties)7 KafkaBuilder (io.strimzi.api.kafka.model.KafkaBuilder)6