Skip to content

Commit

Permalink
kafka_exporter: add compat and expand tests (#31259)
Browse files Browse the repository at this point in the history
Adds `-compat` for `kafka_exporter`:
https://github.com/danielqsj/kafka_exporter/blob/v1.8.0/Dockerfile

---------

Signed-off-by: Dentrax <[email protected]>
  • Loading branch information
Dentrax authored Oct 20, 2024
1 parent a9bfb49 commit 0021d40
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion kafka_exporter.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: kafka_exporter
version: 1.8.0
epoch: 1
epoch: 2
description: "Kafka exporter for Prometheus"
copyright:
- license: Apache-2.0
Expand All @@ -20,14 +20,55 @@ pipeline:

- uses: strip

subpackages:
- name: "${{package.name}}-compat"
description: "Compatibility package to place binaries in the location expected by upstream helm charts"
pipeline:
- runs: |
# https://github.com/danielqsj/kafka_exporter/blob/477643dd764c46ddd804ac4bd4022be877e3085b/Dockerfile#L7
mkdir -p "${{targets.contextdir}}/bin"
ln -sf /usr/bin/kafka_exporter ${{targets.contextdir}}/bin/kafka_exporter
update:
enabled: true
github:
identifier: danielqsj/kafka_exporter
strip-prefix: v

test:
environment:
contents:
packages:
- curl
- kafka
- uuidgen
environment:
JAVA_HOME: "/usr/lib/jvm/default-jvm"
pipeline:
- runs: |
kafka_exporter --version
kafka_exporter --help
- name: "Test with Kafka"
uses: test/daemon-check-output
with:
setup: |
cd /usr/lib/kafka
bin/zookeeper-server-start.sh config/zookeeper.properties &
mv config/server.properties.original config/server.properties
bin/kafka-server-start.sh config/server.properties &
sleep 5
TOPIC_NAME="test-topic-$(uuidgen)"
PARTITIONS=1
REPLICATION_FACTOR=1
# Create a Kafka topic
bin/kafka-topics.sh --create --topic "${TOPIC_NAME}" --partitions "${PARTITIONS}" --replication-factor "${REPLICATION_FACTOR}" --if-not-exists --bootstrap-server localhost:9092
# Produce a test message
echo "Hello Kafka" | bin/kafka-console-producer.sh --broker-list localhost:9092 --topic "${TOPIC_NAME}"
start: kafka_exporter --kafka.server=0.0.0.0:9092
timeout: 15
expected_output: |
Starting kafka_exporter
Listening on
post: |
sleep 5 # Wait awhile until the Kafka metrics are scraped
curl http://localhost:9308/metrics | grep kafka_topic_partitions

0 comments on commit 0021d40

Please sign in to comment.