use of io.strimzi.test.annotations.ParallelTest in project strimzi by strimzi.
the class KafkaMirrorMaker2ClusterTest method testKafkaContainerEnvVarsConflict.
@ParallelTest
public void testKafkaContainerEnvVarsConflict() {
ContainerEnvVar envVar1 = new ContainerEnvVar();
String testEnvOneKey = KafkaMirrorMaker2Cluster.ENV_VAR_KAFKA_CONNECT_CONFIGURATION;
String testEnvOneValue = "test.env.one";
envVar1.setName(testEnvOneKey);
envVar1.setValue(testEnvOneValue);
ContainerEnvVar envVar2 = new ContainerEnvVar();
String testEnvTwoKey = KafkaMirrorMaker2Cluster.ENV_VAR_KAFKA_CONNECT_BOOTSTRAP_SERVERS;
String testEnvTwoValue = "test.env.two";
envVar2.setName(testEnvTwoKey);
envVar2.setValue(testEnvTwoValue);
List<ContainerEnvVar> testEnvs = new ArrayList<>();
testEnvs.add(envVar1);
testEnvs.add(envVar2);
ContainerTemplate kafkaMirrorMaker2Container = new ContainerTemplate();
kafkaMirrorMaker2Container.setEnv(testEnvs);
KafkaMirrorMaker2 resource = new KafkaMirrorMaker2Builder(this.resource).editSpec().withNewTemplate().withConnectContainer(kafkaMirrorMaker2Container).endTemplate().endSpec().build();
List<EnvVar> kafkaEnvVars = KafkaMirrorMaker2Cluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS).getEnvVars();
assertThat("Failed to prevent over writing existing container environment variable: " + testEnvOneKey, kafkaEnvVars.stream().filter(env -> testEnvOneKey.equals(env.getName())).map(EnvVar::getValue).findFirst().orElse("").equals(testEnvOneValue), is(false));
assertThat("Failed to prevent over writing existing container environment variable: " + testEnvTwoKey, kafkaEnvVars.stream().filter(env -> testEnvTwoKey.equals(env.getName())).map(EnvVar::getValue).findFirst().orElse("").equals(testEnvTwoValue), is(false));
}
use of io.strimzi.test.annotations.ParallelTest in project strimzi by strimzi.
the class KafkaMirrorMaker2ClusterTest method testDefaultImagePullSecrets.
@ParallelTest
public void testDefaultImagePullSecrets() {
KafkaMirrorMaker2 resource = new KafkaMirrorMaker2Builder(this.resource).build();
KafkaMirrorMaker2Cluster kmm2 = KafkaMirrorMaker2Cluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS);
Deployment dep = kmm2.generateDeployment(emptyMap(), true, null, null);
assertThat(dep.getSpec().getTemplate().getSpec().getImagePullSecrets(), is(nullValue()));
}
use of io.strimzi.test.annotations.ParallelTest in project strimzi by strimzi.
the class KafkaMirrorMaker2ClusterTest method testInvalidExternalConfigurationEnvs.
@ParallelTest
public void testInvalidExternalConfigurationEnvs() {
ExternalConfigurationEnv env = new ExternalConfigurationEnvBuilder().withName("MY_ENV_VAR").withNewValueFrom().withConfigMapKeyRef(new ConfigMapKeySelectorBuilder().withName("my-map").withKey("my-key").withOptional(false).build()).withSecretKeyRef(new SecretKeySelectorBuilder().withName("my-secret").withKey("my-key").withOptional(false).build()).endValueFrom().build();
KafkaMirrorMaker2 resource = new KafkaMirrorMaker2Builder(this.resource).editSpec().withNewExternalConfiguration().withEnv(env).endExternalConfiguration().endSpec().build();
KafkaMirrorMaker2Cluster kmm2 = KafkaMirrorMaker2Cluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS);
// Check Deployment
Deployment dep = kmm2.generateDeployment(emptyMap(), true, null, null);
List<EnvVar> envs = getContainer(dep).getEnv();
List<EnvVar> selected = envs.stream().filter(var -> var.getName().equals("MY_ENV_VAR")).collect(Collectors.toList());
assertThat(selected.size(), is(0));
}
use of io.strimzi.test.annotations.ParallelTest in project strimzi by strimzi.
the class KafkaMirrorMaker2ClusterTest method testDefaultPodDisruptionBudget.
@ParallelTest
public void testDefaultPodDisruptionBudget() {
KafkaMirrorMaker2 resource = new KafkaMirrorMaker2Builder(this.resource).build();
KafkaMirrorMaker2Cluster kmm2 = KafkaMirrorMaker2Cluster.fromCrd(Reconciliation.DUMMY_RECONCILIATION, resource, VERSIONS);
PodDisruptionBudget pdb = kmm2.generatePodDisruptionBudget();
assertThat(pdb.getSpec().getMaxUnavailable(), is(new IntOrString(1)));
io.fabric8.kubernetes.api.model.policy.v1beta1.PodDisruptionBudget pdbV1Beta1 = kmm2.generatePodDisruptionBudgetV1Beta1();
assertThat(pdbV1Beta1.getSpec().getMaxUnavailable(), is(new IntOrString(1)));
}
use of io.strimzi.test.annotations.ParallelTest in project strimzi by strimzi.
the class KafkaMirrorMaker2ClusterTest method testGenerateService.
@ParallelTest
public void testGenerateService() {
Service svc = kmm2.generateService();
assertThat(svc.getSpec().getType(), is("ClusterIP"));
assertThat(svc.getMetadata().getLabels(), is(expectedLabels(kmm2.getServiceName())));
assertThat(svc.getMetadata().getAnnotations().size(), is(0));
assertThat(svc.getSpec().getSelector(), is(expectedSelectorLabels()));
assertThat(svc.getSpec().getPorts().size(), is(1));
assertThat(svc.getSpec().getPorts().get(0).getPort(), is(Integer.valueOf(KafkaMirrorMaker2Cluster.REST_API_PORT)));
assertThat(svc.getSpec().getPorts().get(0).getName(), is(KafkaMirrorMaker2Cluster.REST_API_PORT_NAME));
assertThat(svc.getSpec().getPorts().get(0).getProtocol(), is("TCP"));
assertThat(svc.getSpec().getIpFamilyPolicy(), is(nullValue()));
assertThat(svc.getSpec().getIpFamilies(), is(emptyList()));
checkOwnerReference(kmm2.createOwnerReference(), svc);
}
Aggregations