From 7635731e4668de81777ab8ba06f15d35777f1c0d Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 17 Aug 2018 09:37:15 +0200 Subject: [PATCH] Test metricbeat kafka module with kafka 2.0.0 (#7992) --- metricbeat/docker-compose.yml | 12 +++++++-- metricbeat/docs/modules/kafka.asciidoc | 2 +- .../_meta/{Dockerfile.1.1.0 => Dockerfile} | 3 ++- .../module/kafka/_meta/Dockerfile.0.10.2 | 25 ------------------- metricbeat/module/kafka/_meta/docs.asciidoc | 2 +- metricbeat/tests/system/test_kafka.py | 4 +++ 6 files changed, 18 insertions(+), 30 deletions(-) rename metricbeat/module/kafka/_meta/{Dockerfile.1.1.0 => Dockerfile} (97%) delete mode 100644 metricbeat/module/kafka/_meta/Dockerfile.0.10.2 diff --git a/metricbeat/docker-compose.yml b/metricbeat/docker-compose.yml index 0ddc7bf6cd1d..e818198a2735 100644 --- a/metricbeat/docker-compose.yml +++ b/metricbeat/docker-compose.yml @@ -98,12 +98,20 @@ services: kafka: build: context: ./module/kafka/_meta - dockerfile: Dockerfile.1.1.0 + args: + KAFKA_VERSION: 2.0.0 + + kafka_1_1_0: + build: + context: ./module/kafka/_meta + args: + KAFKA_VERSION: 1.1.0 kafka_0_10_2: build: context: ./module/kafka/_meta - dockerfile: Dockerfile.0.10.2 + args: + KAFKA_VERSION: 0.10.2.1 kibana: build: ./module/kibana/_meta diff --git a/metricbeat/docs/modules/kafka.asciidoc b/metricbeat/docs/modules/kafka.asciidoc index b9b472645fe7..c83a1f850e26 100644 --- a/metricbeat/docs/modules/kafka.asciidoc +++ b/metricbeat/docs/modules/kafka.asciidoc @@ -14,7 +14,7 @@ The default metricsets are `consumergroup` and `partition`. [float] === Compability -This module is tested with Kafka 0.10.2 and 1.1.0. +This module is tested with Kafka 0.10.2.1, 1.1.0 and 2.0.0. [float] diff --git a/metricbeat/module/kafka/_meta/Dockerfile.1.1.0 b/metricbeat/module/kafka/_meta/Dockerfile similarity index 97% rename from metricbeat/module/kafka/_meta/Dockerfile.1.1.0 rename to metricbeat/module/kafka/_meta/Dockerfile index 54f0d105f12e..aab10dbed24b 100644 --- a/metricbeat/module/kafka/_meta/Dockerfile.1.1.0 +++ b/metricbeat/module/kafka/_meta/Dockerfile @@ -1,9 +1,10 @@ FROM debian:stretch +ARG KAFKA_VERSION=2.0.0 + ENV KAFKA_HOME /kafka # The advertised host is kafka. This means it will not work if container is started locally and connected from localhost to it ENV KAFKA_LOGS_DIR="/kafka-logs" -ENV KAFKA_VERSION 1.1.0 ENV _JAVA_OPTIONS "-Djava.net.preferIPv4Stack=true" ENV TERM=linux diff --git a/metricbeat/module/kafka/_meta/Dockerfile.0.10.2 b/metricbeat/module/kafka/_meta/Dockerfile.0.10.2 deleted file mode 100644 index 52ae3ff0339b..000000000000 --- a/metricbeat/module/kafka/_meta/Dockerfile.0.10.2 +++ /dev/null @@ -1,25 +0,0 @@ -FROM debian:stretch - -ENV KAFKA_HOME /kafka -# The advertised host is kafka. This means it will not work if container is started locally and connected from localhost to it -ENV KAFKA_LOGS_DIR="/kafka-logs" -ENV KAFKA_VERSION 0.10.2.1 -ENV _JAVA_OPTIONS "-Djava.net.preferIPv4Stack=true" -ENV TERM=linux - -RUN apt-get update && apt-get install -y curl openjdk-8-jre-headless netcat dnsutils - -RUN mkdir -p ${KAFKA_LOGS_DIR} && mkdir -p ${KAFKA_HOME} && curl -s -o $INSTALL_DIR/kafka.tgz \ - "http://ftp.wayne.edu/apache/kafka/${KAFKA_VERSION}/kafka_2.11-${KAFKA_VERSION}.tgz" && \ - tar xzf ${INSTALL_DIR}/kafka.tgz -C ${KAFKA_HOME} --strip-components 1 - -ADD run.sh /run.sh -ADD healthcheck.sh /healthcheck.sh - -EXPOSE 9092 -EXPOSE 2181 - -# Healthcheck creates an empty topic foo. As soon as a topic is created, it assumes broke is available -HEALTHCHECK --interval=1s --retries=90 CMD /healthcheck.sh - -ENTRYPOINT ["/run.sh"] diff --git a/metricbeat/module/kafka/_meta/docs.asciidoc b/metricbeat/module/kafka/_meta/docs.asciidoc index 05e52c5369ce..aa228583dbc4 100644 --- a/metricbeat/module/kafka/_meta/docs.asciidoc +++ b/metricbeat/module/kafka/_meta/docs.asciidoc @@ -5,4 +5,4 @@ The default metricsets are `consumergroup` and `partition`. [float] === Compability -This module is tested with Kafka 0.10.2 and 1.1.0. +This module is tested with Kafka 0.10.2.1, 1.1.0 and 2.0.0. diff --git a/metricbeat/tests/system/test_kafka.py b/metricbeat/tests/system/test_kafka.py index 4a21ee3d0605..de38d53d0e70 100644 --- a/metricbeat/tests/system/test_kafka.py +++ b/metricbeat/tests/system/test_kafka.py @@ -45,5 +45,9 @@ def get_hosts(self): os.getenv('KAFKA_PORT', '9092')] +class Kafka_1_1_0_Test(KafkaTest): + COMPOSE_SERVICES = ['kafka_1_1_0'] + + class Kafka_0_10_2_Test(KafkaTest): COMPOSE_SERVICES = ['kafka_0_10_2']