Skip to content

Commit a589000

Browse files
author
amuraru
committed
more tests
1 parent 90ed6a8 commit a589000

File tree

1 file changed

+83
-2
lines changed

1 file changed

+83
-2
lines changed

.github/workflows/e2e-tests.yaml

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
go-version-file: 'go.mod'
2323

24-
- name: Start Kafka 4.0 with KRaft
24+
- name: Start Kafka 4 with KRaft
2525
run: |
2626
docker run -d \
2727
--name broker \
@@ -38,7 +38,7 @@ jobs:
3838
-e KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1 \
3939
-e KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0 \
4040
-e KAFKA_NUM_PARTITIONS=3 \
41-
apache/kafka:4.0.0
41+
apache/kafka:4.1.0
4242
4343
# Wait for Kafka to be ready
4444
echo "Waiting for Kafka to start..."
@@ -193,6 +193,87 @@ jobs:
193193
echo " - Messages produced: $PRODUCED"
194194
echo " - Messages received: $RECEIVED"
195195
196+
- name: Validate built-in KMinion metrics
197+
run: |
198+
echo "Validating built-in KMinion metrics..."
199+
METRICS=$(curl -s http://localhost:8080/metrics)
200+
201+
# Core exporter metrics
202+
CORE_METRICS=(
203+
"kminion_exporter_up"
204+
"kminion_exporter_offset_consumer_records_consumed_total"
205+
)
206+
207+
# Kafka cluster metrics
208+
KAFKA_METRICS=(
209+
"kminion_kafka_cluster_info"
210+
"kminion_kafka_broker_info"
211+
)
212+
213+
# Topic metrics
214+
TOPIC_METRICS=(
215+
"kminion_kafka_topic_info"
216+
"kminion_kafka_topic_partition_count"
217+
"kminion_kafka_topic_partition_high_water_mark"
218+
"kminion_kafka_topic_high_water_mark_sum"
219+
)
220+
221+
MISSING_METRICS=()
222+
223+
# Check core metrics
224+
for metric in "${CORE_METRICS[@]}"; do
225+
if ! echo "$METRICS" | grep -q "^${metric}"; then
226+
MISSING_METRICS+=("$metric")
227+
fi
228+
done
229+
230+
# Check Kafka metrics
231+
for metric in "${KAFKA_METRICS[@]}"; do
232+
if ! echo "$METRICS" | grep -q "^${metric}"; then
233+
MISSING_METRICS+=("$metric")
234+
fi
235+
done
236+
237+
# Check topic metrics
238+
for metric in "${TOPIC_METRICS[@]}"; do
239+
if ! echo "$METRICS" | grep -q "^${metric}"; then
240+
MISSING_METRICS+=("$metric")
241+
fi
242+
done
243+
244+
if [ ${#MISSING_METRICS[@]} -ne 0 ]; then
245+
echo "ERROR: Missing required built-in metrics:"
246+
printf '%s\n' "${MISSING_METRICS[@]}"
247+
echo ""
248+
echo "=== Available metrics ==="
249+
echo "$METRICS" | grep "^kminion_" | head -20
250+
exit 1
251+
fi
252+
253+
# Validate specific metric values
254+
EXPORTER_UP=$(echo "$METRICS" | grep "^kminion_exporter_up" | awk '{print $2}')
255+
if [ "$EXPORTER_UP" != "1" ]; then
256+
echo "ERROR: kminion_exporter_up should be 1, got: $EXPORTER_UP"
257+
exit 1
258+
fi
259+
260+
# Check that cluster info has broker_count label
261+
if ! echo "$METRICS" | grep "kminion_kafka_cluster_info" | grep -q "broker_count"; then
262+
echo "ERROR: kminion_kafka_cluster_info missing broker_count label"
263+
exit 1
264+
fi
265+
266+
# Check that we have broker info for at least one broker
267+
BROKER_COUNT=$(echo "$METRICS" | grep "^kminion_kafka_broker_info" | wc -l)
268+
if [ "$BROKER_COUNT" -lt 1 ]; then
269+
echo "ERROR: No broker info metrics found"
270+
exit 1
271+
fi
272+
273+
echo "✅ Built-in KMinion metrics validation passed!"
274+
echo " - Exporter up: $EXPORTER_UP"
275+
echo " - Brokers detected: $BROKER_COUNT"
276+
196277
- name: Show logs on failure
197278
if: failure()
198279
run: |

0 commit comments

Comments
 (0)