use of org.bf2.operator.operands.KafkaInstanceConfiguration.Kafka in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaClusterTest method testManagedKafkaMaximumSessionLifetimeMapping.
@ParameterizedTest
@CsvSource({ // Default to 4m 59s
", 299000", // No less than zero
"-1, 0", "0, 0", "1, 1", "299000, 299000" })
void testManagedKafkaMaximumSessionLifetimeMapping(Long maximumSessionLifetime, long maxReauthMs) throws IOException {
ManagedKafka mk = exampleManagedKafka("60Gi");
mk.getSpec().getOauth().setMaximumSessionLifetime(maximumSessionLifetime);
Kafka kafka = kafkaCluster.kafkaFrom(mk, null);
assertEquals(maxReauthMs, kafka.getSpec().getKafka().getConfig().get("connections.max.reauth.ms"));
}
use of org.bf2.operator.operands.KafkaInstanceConfiguration.Kafka in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaClusterTest method pausedUnknownStatus.
@Test
void pausedUnknownStatus() throws InterruptedException {
ManagedKafka mk = ManagedKafka.getDummyInstance(1);
InformerManager informer = Mockito.mock(InformerManager.class);
Kafka kafka = new KafkaBuilder(this.kafkaCluster.kafkaFrom(mk, null)).editMetadata().withAnnotations(Map.of(StrimziManager.STRIMZI_PAUSE_REASON_ANNOTATION, "custom")).endMetadata().withNewStatus().withConditions(new ConditionBuilder().withType("ReconciliationPaused").withStatus("True").build()).endStatus().build();
Mockito.when(informer.getLocalKafka(Mockito.anyString(), Mockito.anyString())).thenReturn(kafka);
QuarkusMock.installMockForType(informer, InformerManager.class);
OperandReadiness readiness = this.kafkaCluster.getReadiness(mk);
assertEquals(Status.Unknown, readiness.getStatus());
assertEquals(Reason.Paused, readiness.getReason());
assertEquals("Kafka mk-1 is paused for an unknown reason", readiness.getMessage());
}
use of org.bf2.operator.operands.KafkaInstanceConfiguration.Kafka in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaClusterTest method testScalingAndReplicationFactor.
@Test
void testScalingAndReplicationFactor() throws IOException {
KafkaInstanceConfiguration config = kafkaCluster.getKafkaConfiguration();
try {
KafkaInstanceConfiguration clone = Serialization.clone(config);
clone.getKafka().setScalingAndReplicationFactor(1);
kafkaCluster.setKafkaConfiguration(clone);
ManagedKafka mk = exampleManagedKafka("60Gi");
Kafka kafka = kafkaCluster.kafkaFrom(mk, null);
diffToExpected(kafka.getSpec().getKafka().getConfig(), "/expected/scaling-one.yml");
} finally {
kafkaCluster.setKafkaConfiguration(config);
}
}
use of org.bf2.operator.operands.KafkaInstanceConfiguration.Kafka in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaClusterTest method testManagedKafkaToKafkaWithCustomConfiguration.
@Test
void testManagedKafkaToKafkaWithCustomConfiguration() throws IOException {
KafkaInstanceConfiguration config = kafkaCluster.getKafkaConfiguration();
try {
KafkaInstanceConfiguration clone = Serialization.clone(config);
clone.getKafka().setConnectionAttemptsPerSec(300);
clone.getKafka().setContainerMemory("2Gi");
clone.getKafka().setJvmXx("foo bar, foo2 bar2");
clone.getZookeeper().setReplicas(5);
clone.getZookeeper().setContainerMemory("11Gi");
clone.getZookeeper().setJvmXx("zkfoo zkbar, zkfoo2 zkbar2");
clone.getKafka().setOneInstancePerNode(false);
clone.getKafka().setColocateWithZookeeper(false);
clone.getExporter().setColocateWithZookeeper(false);
kafkaCluster.setKafkaConfiguration(clone);
ManagedKafka mk = exampleManagedKafka("60Gi");
mk.getSpec().getCapacity().setMaxPartitions(2 * clone.getKafka().getPartitionCapacity());
Kafka kafka = kafkaCluster.kafkaFrom(mk, null);
diffToExpected(kafka, "/expected/custom-config-strimzi.yml");
} finally {
kafkaCluster.setKafkaConfiguration(config);
}
}
use of org.bf2.operator.operands.KafkaInstanceConfiguration.Kafka in project kas-fleetshard by bf2fc6cc711aee1a0c2a.
the class KafkaClusterTest method testDrainCleanerWebhookFound.
@Test
void testDrainCleanerWebhookFound() throws IOException {
DrainCleanerManager mock = Mockito.mock(DrainCleanerManager.class);
Mockito.when(mock.isDrainCleanerWebhookFound()).thenReturn(true);
QuarkusMock.installMockForType(mock, DrainCleanerManager.class);
ManagedKafka mk = exampleManagedKafka("40Gi");
Kafka kafka = kafkaCluster.kafkaFrom(mk, null);
assertEquals(0, kafka.getSpec().getKafka().getTemplate().getPodDisruptionBudget().getMaxUnavailable());
assertEquals(0, kafka.getSpec().getZookeeper().getTemplate().getPodDisruptionBudget().getMaxUnavailable());
}
Aggregations