use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.
the class MetricsIsolatedST method testZookeeperQuorumSize.
@ParallelTest
@Tag(ACCEPTANCE)
void testZookeeperQuorumSize() {
Pattern quorumSize = Pattern.compile("zookeeper_quorumsize ([\\d.][^\\n]+)", Pattern.CASE_INSENSITIVE);
ArrayList<Double> values = MetricsCollector.collectSpecificMetric(quorumSize, zookeeperMetricsData);
assertThat("Zookeeper quorum size doesn't match expected value", values.stream().mapToDouble(i -> i).max(), is(OptionalDouble.of(3.0)));
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.
the class MetricsIsolatedST method testKafkaMetricsSettings.
/**
* 1. Update metrics form whatever it is to @metricsConfigYaml in spec.kafka.metricsConfig
* 2. Check, whether the metrics ConfigMap is changed
* 3. Updates ConfigMap linked as metrics on
* 4. Check, whether the metrics ConfigMap is changed
*/
@ParallelTest
void testKafkaMetricsSettings() {
String metricsConfigJson = "{\"lowercaseOutputName\":true}";
String metricsConfigYaml = "lowercaseOutputName: true";
ObjectMapper mapper = new ObjectMapper();
mapper.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true);
ConfigMap externalMetricsCm = new ConfigMapBuilder().withData(Collections.singletonMap(Constants.METRICS_CONFIG_YAML_NAME, metricsConfigYaml)).withNewMetadata().withName("external-metrics-cm").withNamespace(SECOND_NAMESPACE).endMetadata().build();
kubeClient().getClient().configMaps().inNamespace(SECOND_NAMESPACE).createOrReplace(externalMetricsCm);
// spec.kafka.metrics -> spec.kafka.jmxExporterMetrics
ConfigMapKeySelector cmks = new ConfigMapKeySelectorBuilder().withName("external-metrics-cm").withKey(Constants.METRICS_CONFIG_YAML_NAME).build();
JmxPrometheusExporterMetrics jmxPrometheusExporterMetrics = new JmxPrometheusExporterMetricsBuilder().withNewValueFrom().withConfigMapKeyRef(cmks).endValueFrom().build();
KafkaResource.replaceKafkaResourceInSpecificNamespace(SECOND_CLUSTER, k -> {
k.getSpec().getKafka().setMetricsConfig(jmxPrometheusExporterMetrics);
}, SECOND_NAMESPACE);
PodUtils.verifyThatRunningPodsAreStable(SECOND_NAMESPACE, SECOND_CLUSTER);
ConfigMap actualCm = kubeClient(SECOND_NAMESPACE).getConfigMap(KafkaResources.kafkaMetricsAndLogConfigMapName(SECOND_CLUSTER));
assertThat(actualCm.getData().get(Constants.METRICS_CONFIG_JSON_NAME), is(metricsConfigJson));
// update metrics
ConfigMap externalMetricsUpdatedCm = new ConfigMapBuilder().withData(Collections.singletonMap(Constants.METRICS_CONFIG_YAML_NAME, metricsConfigYaml.replace("true", "false"))).withNewMetadata().withName("external-metrics-cm").withNamespace(SECOND_NAMESPACE).endMetadata().build();
kubeClient().getClient().configMaps().inNamespace(SECOND_NAMESPACE).createOrReplace(externalMetricsUpdatedCm);
PodUtils.verifyThatRunningPodsAreStable(SECOND_NAMESPACE, SECOND_CLUSTER);
actualCm = kubeClient(SECOND_NAMESPACE).getConfigMap(KafkaResources.kafkaMetricsAndLogConfigMapName(SECOND_CLUSTER));
assertThat(actualCm.getData().get(Constants.METRICS_CONFIG_JSON_NAME), is(metricsConfigJson.replace("true", "false")));
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.
the class MetricsIsolatedST method testKafkaTopicUnderReplicatedPartitions.
@ParallelTest
void testKafkaTopicUnderReplicatedPartitions() {
Pattern underReplicatedPartitions = Pattern.compile("kafka_server_replicamanager_underreplicatedpartitions ([\\d.][^\\n]+)", Pattern.CASE_INSENSITIVE);
ArrayList<Double> values = MetricsCollector.collectSpecificMetric(underReplicatedPartitions, kafkaMetricsData);
assertThat("Topic under-replicated partitions doesn't match expected value", values.stream().mapToDouble(i -> i).sum(), is((double) 0));
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.
the class MetricsIsolatedST method testKafkaBrokersCount.
@ParallelTest
@Tag(ACCEPTANCE)
void testKafkaBrokersCount() {
Pattern brokerOnlineCount = Pattern.compile("kafka_server_replicamanager_leadercount ([\\d.][^\\n]+)", Pattern.CASE_INSENSITIVE);
ArrayList<Double> values = MetricsCollector.collectSpecificMetric(brokerOnlineCount, kafkaMetricsData);
assertThat("Broker count doesn't match expected value", values.size(), is(3));
}
use of io.strimzi.systemtest.annotations.ParallelTest in project strimzi-kafka-operator by strimzi.
the class ThrottlingQuotaST method testThrottlingQuotasCreateTopic.
/**
* Test checks for throttling quotas set for user
* on creation & deletion of topics and create partition operations.
*/
@ParallelTest
void testThrottlingQuotasCreateTopic(ExtensionContext extensionContext) {
final String kafkaUsername = mapWithTestUsers.get(extensionContext.getDisplayName());
final String createAdminName = "create-admin-" + mapWithKafkaClientNames.get(extensionContext.getDisplayName());
final String topicNamePrefix = classTopicPrefix + "-create";
int topicsCountOverQuota = 500;
setupKafkaUserInNamespace(extensionContext, kafkaUsername);
KafkaAdminClients adminClientJob = new KafkaAdminClientsBuilder().withAdminName(createAdminName).withBootstrapAddress(KafkaResources.plainBootstrapAddress(CLUSTER_NAME)).withTopicName(topicNamePrefix).withTopicCount(topicsCountOverQuota).withNamespaceName(namespace).withTopicOperation(AdminClientOperations.CREATE_TOPICS.toString()).withAdditionalConfig(KafkaAdminClients.getAdminClientScramConfig(namespace, kafkaUsername, 240000)).build();
resourceManager.createResource(extensionContext, adminClientJob.defaultAdmin());
String createPodName = kubeClient(namespace).listPodNamesInSpecificNamespace(namespace, "job-name", createAdminName).get(0);
PodUtils.waitUntilMessageIsInPodLogs(namespace, createPodName, "org.apache.kafka.common.errors.ThrottlingQuotaExceededException: The throttling quota has been exceeded.", GLOBAL_TIMEOUT);
JobUtils.deleteJobWithWait(namespace, createAdminName);
// Teardown delete created topics
KafkaTopicUtils.deleteAllKafkaTopicsWithPrefix(namespace, topicNamePrefix);
}
Aggregations